// Copyright 2025 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by sidekick. DO NOT EDIT.

#![allow(rustdoc::redundant_explicit_links)]
#![allow(rustdoc::broken_intra_doc_links)]
#![no_implicit_prelude]
extern crate async_trait;
extern crate bytes;
extern crate gax;
extern crate gaxi;
extern crate iam_v1;
extern crate lazy_static;
extern crate location;
extern crate longrunning;
extern crate lro;
extern crate reqwest;
extern crate serde;
extern crate serde_json;
extern crate serde_with;
extern crate std;
extern crate tracing;
extern crate wkt;

mod debug;
mod deserialize;
mod serialize;

/// Represents the metadata of the long-running operation.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct OperationMetadata {
    /// Output only. The time the operation was created.
    pub create_time: std::option::Option<wkt::Timestamp>,

    /// Output only. The time the operation finished running.
    pub end_time: std::option::Option<wkt::Timestamp>,

    /// Output only. Server-defined resource path for the target of the operation.
    pub target: std::string::String,

    /// Output only. Name of the verb executed by the operation.
    pub verb: std::string::String,

    /// Output only. Human-readable status of the operation, if any.
    pub status_message: std::string::String,

    /// Output only. Identifies whether the user has requested cancellation
    /// of the operation. Operations that have successfully been cancelled
    /// have [Operation.error][] value with a
    /// [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to
    /// `Code.CANCELLED`.
    ///
    /// [google.rpc.Status.code]: rpc::model::Status::code
    pub requested_cancellation: bool,

    /// Output only. API version used to start the operation.
    pub api_version: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl OperationMetadata {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [create_time][crate::model::OperationMetadata::create_time].
    pub fn set_create_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [create_time][crate::model::OperationMetadata::create_time].
    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [end_time][crate::model::OperationMetadata::end_time].
    pub fn set_end_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.end_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [end_time][crate::model::OperationMetadata::end_time].
    pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.end_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [target][crate::model::OperationMetadata::target].
    pub fn set_target<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.target = v.into();
        self
    }

    /// Sets the value of [verb][crate::model::OperationMetadata::verb].
    pub fn set_verb<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.verb = v.into();
        self
    }

    /// Sets the value of [status_message][crate::model::OperationMetadata::status_message].
    pub fn set_status_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.status_message = v.into();
        self
    }

    /// Sets the value of [requested_cancellation][crate::model::OperationMetadata::requested_cancellation].
    pub fn set_requested_cancellation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.requested_cancellation = v.into();
        self
    }

    /// Sets the value of [api_version][crate::model::OperationMetadata::api_version].
    pub fn set_api_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.api_version = v.into();
        self
    }
}

impl wkt::message::Message for OperationMetadata {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.OperationMetadata"
    }
}

/// Specification of a port-based selector.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct TrafficPortSelector {
    /// Optional. A list of ports. Can be port numbers or port range
    /// (example, [80-90] specifies all ports from 80 to 90, including
    /// 80 and 90) or named ports or * to specify all ports. If the
    /// list is empty, all ports are selected.
    pub ports: std::vec::Vec<std::string::String>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl TrafficPortSelector {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [ports][crate::model::TrafficPortSelector::ports].
    pub fn set_ports<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.ports = v.into_iter().map(|i| i.into()).collect();
        self
    }
}

impl wkt::message::Message for TrafficPortSelector {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.TrafficPortSelector"
    }
}

/// A definition of a matcher that selects endpoints to which the policies
/// should be applied.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct EndpointMatcher {
    /// Specifies type of the matcher used for this endpoint matcher.
    pub matcher_type: std::option::Option<crate::model::endpoint_matcher::MatcherType>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl EndpointMatcher {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [matcher_type][crate::model::EndpointMatcher::matcher_type].
    ///
    /// Note that all the setters affecting `matcher_type` are mutually
    /// exclusive.
    pub fn set_matcher_type<
        T: std::convert::Into<std::option::Option<crate::model::endpoint_matcher::MatcherType>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.matcher_type = v.into();
        self
    }

    /// The value of [matcher_type][crate::model::EndpointMatcher::matcher_type]
    /// if it holds a `MetadataLabelMatcher`, `None` if the field is not set or
    /// holds a different branch.
    pub fn metadata_label_matcher(
        &self,
    ) -> std::option::Option<&std::boxed::Box<crate::model::endpoint_matcher::MetadataLabelMatcher>>
    {
        #[allow(unreachable_patterns)]
        self.matcher_type.as_ref().and_then(|v| match v {
            crate::model::endpoint_matcher::MatcherType::MetadataLabelMatcher(v) => {
                std::option::Option::Some(v)
            }
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [matcher_type][crate::model::EndpointMatcher::matcher_type]
    /// to hold a `MetadataLabelMatcher`.
    ///
    /// Note that all the setters affecting `matcher_type` are
    /// mutually exclusive.
    pub fn set_metadata_label_matcher<
        T: std::convert::Into<std::boxed::Box<crate::model::endpoint_matcher::MetadataLabelMatcher>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.matcher_type = std::option::Option::Some(
            crate::model::endpoint_matcher::MatcherType::MetadataLabelMatcher(v.into()),
        );
        self
    }
}

impl wkt::message::Message for EndpointMatcher {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.EndpointMatcher"
    }
}

/// Defines additional types related to [EndpointMatcher].
pub mod endpoint_matcher {
    #[allow(unused_imports)]
    use super::*;

    /// The matcher that is based on node metadata presented by xDS clients.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct MetadataLabelMatcher {
        /// Specifies how matching should be done.
        ///
        /// Supported values are:
        /// MATCH_ANY: At least one of the Labels specified in the
        /// matcher should match the metadata presented by xDS client.
        /// MATCH_ALL: The metadata presented by the xDS client should
        /// contain all of the labels specified here.
        ///
        /// The selection is determined based on the best match. For
        /// example, suppose there are three EndpointPolicy
        /// resources P1, P2 and P3 and if P1 has a the matcher as
        /// MATCH_ANY <A:1, B:1>, P2 has MATCH_ALL <A:1,B:1>, and P3 has
        /// MATCH_ALL <A:1,B:1,C:1>.
        ///
        /// If a client with label <A:1> connects, the config from P1
        /// will be selected.
        ///
        /// If a client with label <A:1,B:1> connects, the config from P2
        /// will be selected.
        ///
        /// If a client with label <A:1,B:1,C:1> connects, the config
        /// from P3 will be selected.
        ///
        /// If there is more than one best match, (for example, if a
        /// config P4 with selector <A:1,D:1> exists and if a client with
        /// label <A:1,B:1,D:1> connects), pick up the one with older creation time.
        pub metadata_label_match_criteria:
            crate::model::endpoint_matcher::metadata_label_matcher::MetadataLabelMatchCriteria,

        /// The list of label value pairs that must match labels in the
        /// provided metadata based on filterMatchCriteria This list can
        /// have at most 64 entries. The list can be empty if the match
        /// criteria is MATCH_ANY, to specify a wildcard match (i.e this
        /// matches any client).
        pub metadata_labels:
            std::vec::Vec<crate::model::endpoint_matcher::metadata_label_matcher::MetadataLabels>,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl MetadataLabelMatcher {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [metadata_label_match_criteria][crate::model::endpoint_matcher::MetadataLabelMatcher::metadata_label_match_criteria].
        pub fn set_metadata_label_match_criteria<T: std::convert::Into<crate::model::endpoint_matcher::metadata_label_matcher::MetadataLabelMatchCriteria>>(mut self, v: T) -> Self{
            self.metadata_label_match_criteria = v.into();
            self
        }

        /// Sets the value of [metadata_labels][crate::model::endpoint_matcher::MetadataLabelMatcher::metadata_labels].
        pub fn set_metadata_labels<T, V>(mut self, v: T) -> Self
        where
            T: std::iter::IntoIterator<Item = V>,
            V: std::convert::Into<
                    crate::model::endpoint_matcher::metadata_label_matcher::MetadataLabels,
                >,
        {
            use std::iter::Iterator;
            self.metadata_labels = v.into_iter().map(|i| i.into()).collect();
            self
        }
    }

    impl wkt::message::Message for MetadataLabelMatcher {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.networkservices.v1.EndpointMatcher.MetadataLabelMatcher"
        }
    }

    /// Defines additional types related to [MetadataLabelMatcher].
    pub mod metadata_label_matcher {
        #[allow(unused_imports)]
        use super::*;

        /// Defines a name-pair value for a single label.
        #[derive(Clone, Default, PartialEq)]
        #[non_exhaustive]
        pub struct MetadataLabels {
            /// Required. Label name presented as key in xDS Node Metadata.
            pub label_name: std::string::String,

            /// Required. Label value presented as value corresponding to the above
            /// key, in xDS Node Metadata.
            pub label_value: std::string::String,

            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
        }

        impl MetadataLabels {
            pub fn new() -> Self {
                std::default::Default::default()
            }

            /// Sets the value of [label_name][crate::model::endpoint_matcher::metadata_label_matcher::MetadataLabels::label_name].
            pub fn set_label_name<T: std::convert::Into<std::string::String>>(
                mut self,
                v: T,
            ) -> Self {
                self.label_name = v.into();
                self
            }

            /// Sets the value of [label_value][crate::model::endpoint_matcher::metadata_label_matcher::MetadataLabels::label_value].
            pub fn set_label_value<T: std::convert::Into<std::string::String>>(
                mut self,
                v: T,
            ) -> Self {
                self.label_value = v.into();
                self
            }
        }

        impl wkt::message::Message for MetadataLabels {
            fn typename() -> &'static str {
                "type.googleapis.com/google.cloud.networkservices.v1.EndpointMatcher.MetadataLabelMatcher.MetadataLabels"
            }
        }

        /// Possible criteria values that define logic of how matching is made.
        ///
        /// # Working with unknown values
        ///
        /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
        /// additional enum variants at any time. Adding new variants is not considered
        /// a breaking change. Applications should write their code in anticipation of:
        ///
        /// - New values appearing in future releases of the client library, **and**
        /// - New values received dynamically, without application changes.
        ///
        /// Please consult the [Working with enums] section in the user guide for some
        /// guidelines.
        ///
        /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
        #[derive(Clone, Debug, PartialEq)]
        #[non_exhaustive]
        pub enum MetadataLabelMatchCriteria {
            /// Default value. Should not be used.
            Unspecified,
            /// At least one of the Labels specified in the matcher should match the
            /// metadata presented by xDS client.
            MatchAny,
            /// The metadata presented by the xDS client should contain all of the
            /// labels specified here.
            MatchAll,
            /// If set, the enum was initialized with an unknown value.
            ///
            /// Applications can examine the value using [MetadataLabelMatchCriteria::value] or
            /// [MetadataLabelMatchCriteria::name].
            UnknownValue(metadata_label_match_criteria::UnknownValue),
        }

        #[doc(hidden)]
        pub mod metadata_label_match_criteria {
            #[allow(unused_imports)]
            use super::*;
            #[derive(Clone, Debug, PartialEq)]
            pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
        }

        impl MetadataLabelMatchCriteria {
            /// Gets the enum value.
            ///
            /// Returns `None` if the enum contains an unknown value deserialized from
            /// the string representation of enums.
            pub fn value(&self) -> std::option::Option<i32> {
                match self {
                    Self::Unspecified => std::option::Option::Some(0),
                    Self::MatchAny => std::option::Option::Some(1),
                    Self::MatchAll => std::option::Option::Some(2),
                    Self::UnknownValue(u) => u.0.value(),
                }
            }

            /// Gets the enum value as a string.
            ///
            /// Returns `None` if the enum contains an unknown value deserialized from
            /// the integer representation of enums.
            pub fn name(&self) -> std::option::Option<&str> {
                match self {
                    Self::Unspecified => {
                        std::option::Option::Some("METADATA_LABEL_MATCH_CRITERIA_UNSPECIFIED")
                    }
                    Self::MatchAny => std::option::Option::Some("MATCH_ANY"),
                    Self::MatchAll => std::option::Option::Some("MATCH_ALL"),
                    Self::UnknownValue(u) => u.0.name(),
                }
            }
        }

        impl std::default::Default for MetadataLabelMatchCriteria {
            fn default() -> Self {
                use std::convert::From;
                Self::from(0)
            }
        }

        impl std::fmt::Display for MetadataLabelMatchCriteria {
            fn fmt(
                &self,
                f: &mut std::fmt::Formatter<'_>,
            ) -> std::result::Result<(), std::fmt::Error> {
                wkt::internal::display_enum(f, self.name(), self.value())
            }
        }

        impl std::convert::From<i32> for MetadataLabelMatchCriteria {
            fn from(value: i32) -> Self {
                match value {
                    0 => Self::Unspecified,
                    1 => Self::MatchAny,
                    2 => Self::MatchAll,
                    _ => Self::UnknownValue(metadata_label_match_criteria::UnknownValue(
                        wkt::internal::UnknownEnumValue::Integer(value),
                    )),
                }
            }
        }

        impl std::convert::From<&str> for MetadataLabelMatchCriteria {
            fn from(value: &str) -> Self {
                use std::string::ToString;
                match value {
                    "METADATA_LABEL_MATCH_CRITERIA_UNSPECIFIED" => Self::Unspecified,
                    "MATCH_ANY" => Self::MatchAny,
                    "MATCH_ALL" => Self::MatchAll,
                    _ => Self::UnknownValue(metadata_label_match_criteria::UnknownValue(
                        wkt::internal::UnknownEnumValue::String(value.to_string()),
                    )),
                }
            }
        }

        impl serde::ser::Serialize for MetadataLabelMatchCriteria {
            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
            where
                S: serde::Serializer,
            {
                match self {
                    Self::Unspecified => serializer.serialize_i32(0),
                    Self::MatchAny => serializer.serialize_i32(1),
                    Self::MatchAll => serializer.serialize_i32(2),
                    Self::UnknownValue(u) => u.0.serialize(serializer),
                }
            }
        }

        impl<'de> serde::de::Deserialize<'de> for MetadataLabelMatchCriteria {
            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                deserializer.deserialize_any(wkt::internal::EnumVisitor::<MetadataLabelMatchCriteria>::new(
                    ".google.cloud.networkservices.v1.EndpointMatcher.MetadataLabelMatcher.MetadataLabelMatchCriteria"))
            }
        }
    }

    /// Specifies type of the matcher used for this endpoint matcher.
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum MatcherType {
        /// The matcher is based on node metadata presented by xDS clients.
        MetadataLabelMatcher(std::boxed::Box<crate::model::endpoint_matcher::MetadataLabelMatcher>),
    }
}

/// A single extension chain wrapper that contains the match conditions and
/// extensions to execute.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ExtensionChain {
    /// Required. The name for this extension chain.
    /// The name is logged as part of the HTTP request logs.
    /// The name must conform with RFC-1034, is restricted to lower-cased letters,
    /// numbers and hyphens, and can have a maximum length of 63 characters.
    /// Additionally, the first character must be a letter and the last a letter or
    /// a number.
    pub name: std::string::String,

    /// Required. Conditions under which this chain is invoked for a request.
    pub match_condition: std::option::Option<crate::model::extension_chain::MatchCondition>,

    /// Required. A set of extensions to execute for the matching request.
    /// At least one extension is required.
    /// Up to 3 extensions can be defined for each extension chain
    /// for `LbTrafficExtension` resource.
    /// `LbRouteExtension` and `LbEdgeExtension` chains are limited to 1 extension
    /// per extension chain.
    pub extensions: std::vec::Vec<crate::model::extension_chain::Extension>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ExtensionChain {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::ExtensionChain::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [match_condition][crate::model::ExtensionChain::match_condition].
    pub fn set_match_condition<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::extension_chain::MatchCondition>,
    {
        self.match_condition = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [match_condition][crate::model::ExtensionChain::match_condition].
    pub fn set_or_clear_match_condition<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::extension_chain::MatchCondition>,
    {
        self.match_condition = v.map(|x| x.into());
        self
    }

    /// Sets the value of [extensions][crate::model::ExtensionChain::extensions].
    pub fn set_extensions<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::extension_chain::Extension>,
    {
        use std::iter::Iterator;
        self.extensions = v.into_iter().map(|i| i.into()).collect();
        self
    }
}

impl wkt::message::Message for ExtensionChain {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.ExtensionChain"
    }
}

/// Defines additional types related to [ExtensionChain].
pub mod extension_chain {
    #[allow(unused_imports)]
    use super::*;

    /// Conditions under which this chain is invoked for a request.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct MatchCondition {
        /// Required. A Common Expression Language (CEL) expression that is used to
        /// match requests for which the extension chain is executed.
        ///
        /// For more information, see [CEL matcher language
        /// reference](https://cloud.google.com/service-extensions/docs/cel-matcher-language-reference).
        pub cel_expression: std::string::String,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl MatchCondition {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [cel_expression][crate::model::extension_chain::MatchCondition::cel_expression].
        pub fn set_cel_expression<T: std::convert::Into<std::string::String>>(
            mut self,
            v: T,
        ) -> Self {
            self.cel_expression = v.into();
            self
        }
    }

    impl wkt::message::Message for MatchCondition {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.networkservices.v1.ExtensionChain.MatchCondition"
        }
    }

    /// A single extension in the chain to execute for the matching request.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct Extension {
        /// Required. The name for this extension.
        /// The name is logged as part of the HTTP request logs.
        /// The name must conform with RFC-1034, is restricted to lower-cased
        /// letters, numbers and hyphens, and can have a maximum length of 63
        /// characters. Additionally, the first character must be a letter and the
        /// last a letter or a number.
        pub name: std::string::String,

        /// Optional. The `:authority` header in the gRPC request sent from Envoy
        /// to the extension service.
        /// Required for Callout extensions.
        ///
        /// This field is not supported for plugin extensions. Setting it results in
        /// a validation error.
        pub authority: std::string::String,

        /// Required. The reference to the service that runs the extension.
        ///
        /// To configure a callout extension, `service` must be a fully-qualified
        /// reference
        /// to a [backend
        /// service](https://cloud.google.com/compute/docs/reference/rest/v1/backendServices)
        /// in the format:
        /// `<https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/backendServices/{backendService}>`
        /// or
        /// `<https://www.googleapis.com/compute/v1/projects/{project}/global/backendServices/{backendService}>`.
        ///
        /// To configure a plugin extension, `service` must be a reference
        /// to a [`WasmPlugin`
        /// resource](https://cloud.google.com/service-extensions/docs/reference/rest/v1beta1/projects.locations.wasmPlugins)
        /// in the format:
        /// `projects/{project}/locations/{location}/wasmPlugins/{plugin}`
        /// or
        /// `//networkservices.googleapis.com/projects/{project}/locations/{location}/wasmPlugins/{wasmPlugin}`.
        ///
        /// Plugin extensions are currently supported for the
        /// `LbTrafficExtension`, the `LbRouteExtension`, and the `LbEdgeExtension`
        /// resources.
        pub service: std::string::String,

        /// Optional. A set of events during request or response processing for which
        /// this extension is called.
        ///
        /// For the `LbTrafficExtension` resource, this field is required.
        ///
        /// For the `LbRouteExtension` resource, this field is optional. If
        /// unspecified, `REQUEST_HEADERS` event is assumed as supported.
        ///
        /// For the `LbEdgeExtension` resource, this field is required and must only
        /// contain `REQUEST_HEADERS` event.
        pub supported_events: std::vec::Vec<crate::model::EventType>,

        /// Optional. Specifies the timeout for each individual message on the
        /// stream. The timeout must be between `10`-`10000` milliseconds. Required
        /// for callout extensions.
        ///
        /// This field is not supported for plugin extensions. Setting it results in
        /// a validation error.
        pub timeout: std::option::Option<wkt::Duration>,

        /// Optional. Determines how the proxy behaves if the call to the extension
        /// fails or times out.
        ///
        /// When set to `TRUE`, request or response processing continues without
        /// error. Any subsequent extensions in the extension chain are also
        /// executed. When set to `FALSE` or the default setting of `FALSE` is used,
        /// one of the following happens:
        ///
        /// * If response headers have not been delivered to the downstream client,
        ///   a generic 500 error is returned to the client. The error response can be
        ///   tailored by configuring a custom error response in the load balancer.
        ///
        /// * If response headers have been delivered, then the HTTP stream to the
        ///   downstream client is reset.
        ///
        pub fail_open: bool,

        /// Optional. List of the HTTP headers to forward to the extension
        /// (from the client or backend). If omitted, all headers are sent.
        /// Each element is a string indicating the header name.
        pub forward_headers: std::vec::Vec<std::string::String>,

        /// Optional. The metadata provided here is included as part of the
        /// `metadata_context` (of type `google.protobuf.Struct`) in the
        /// `ProcessingRequest` message sent to the extension server.
        ///
        /// The metadata is available under the namespace
        /// `com.google.<extension_type>.<resource_name>.<extension_chain_name>.<extension_name>`.
        /// For example:
        /// `com.google.lb_traffic_extension.lbtrafficextension1.chain1.ext1`.
        ///
        /// The following variables are supported in the metadata:
        ///
        /// `{forwarding_rule_id}` - substituted with the forwarding rule's fully
        /// qualified resource name.
        ///
        /// This field must not be set for plugin extensions. Setting it results in
        /// a validation error.
        ///
        /// You can set metadata at either the resource level or the extension level.
        /// The extension level metadata is recommended because you can pass a
        /// different set of metadata through each extension to the backend.
        ///
        /// This field is subject to following limitations:
        ///
        /// * The total size of the metadata must be less than 1KiB.
        /// * The total number of keys in the metadata must be less than 16.
        /// * The length of each key must be less than 64 characters.
        /// * The length of each value must be less than 1024 characters.
        /// * All values must be strings.
        pub metadata: std::option::Option<wkt::Struct>,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl Extension {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [name][crate::model::extension_chain::Extension::name].
        pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
            self.name = v.into();
            self
        }

        /// Sets the value of [authority][crate::model::extension_chain::Extension::authority].
        pub fn set_authority<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
            self.authority = v.into();
            self
        }

        /// Sets the value of [service][crate::model::extension_chain::Extension::service].
        pub fn set_service<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
            self.service = v.into();
            self
        }

        /// Sets the value of [supported_events][crate::model::extension_chain::Extension::supported_events].
        pub fn set_supported_events<T, V>(mut self, v: T) -> Self
        where
            T: std::iter::IntoIterator<Item = V>,
            V: std::convert::Into<crate::model::EventType>,
        {
            use std::iter::Iterator;
            self.supported_events = v.into_iter().map(|i| i.into()).collect();
            self
        }

        /// Sets the value of [timeout][crate::model::extension_chain::Extension::timeout].
        pub fn set_timeout<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<wkt::Duration>,
        {
            self.timeout = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [timeout][crate::model::extension_chain::Extension::timeout].
        pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<wkt::Duration>,
        {
            self.timeout = v.map(|x| x.into());
            self
        }

        /// Sets the value of [fail_open][crate::model::extension_chain::Extension::fail_open].
        pub fn set_fail_open<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
            self.fail_open = v.into();
            self
        }

        /// Sets the value of [forward_headers][crate::model::extension_chain::Extension::forward_headers].
        pub fn set_forward_headers<T, V>(mut self, v: T) -> Self
        where
            T: std::iter::IntoIterator<Item = V>,
            V: std::convert::Into<std::string::String>,
        {
            use std::iter::Iterator;
            self.forward_headers = v.into_iter().map(|i| i.into()).collect();
            self
        }

        /// Sets the value of [metadata][crate::model::extension_chain::Extension::metadata].
        pub fn set_metadata<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<wkt::Struct>,
        {
            self.metadata = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [metadata][crate::model::extension_chain::Extension::metadata].
        pub fn set_or_clear_metadata<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<wkt::Struct>,
        {
            self.metadata = v.map(|x| x.into());
            self
        }
    }

    impl wkt::message::Message for Extension {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.networkservices.v1.ExtensionChain.Extension"
        }
    }
}

/// `LbTrafficExtension` is a resource that lets the extension service modify the
/// headers and payloads of both requests and responses without impacting the
/// choice of backend services or any other security policies associated with the
/// backend service.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct LbTrafficExtension {
    /// Required. Identifier. Name of the `LbTrafficExtension` resource in the
    /// following format:
    /// `projects/{project}/locations/{location}/lbTrafficExtensions/{lb_traffic_extension}`.
    pub name: std::string::String,

    /// Output only. The timestamp when the resource was created.
    pub create_time: std::option::Option<wkt::Timestamp>,

    /// Output only. The timestamp when the resource was updated.
    pub update_time: std::option::Option<wkt::Timestamp>,

    /// Optional. A human-readable description of the resource.
    pub description: std::string::String,

    /// Optional. Set of labels associated with the `LbTrafficExtension` resource.
    ///
    /// The format must comply with [the requirements for
    /// labels](https://cloud.google.com/compute/docs/labeling-resources#requirements)
    /// for Google Cloud resources.
    pub labels: std::collections::HashMap<std::string::String, std::string::String>,

    /// Optional. A list of references to the forwarding rules to which this
    /// service extension is attached. At least one forwarding rule is required.
    /// Only one `LbTrafficExtension` resource can be associated with a forwarding
    /// rule.
    pub forwarding_rules: std::vec::Vec<std::string::String>,

    /// Required. A set of ordered extension chains that contain the match
    /// conditions and extensions to execute. Match conditions for each extension
    /// chain are evaluated in sequence for a given request. The first extension
    /// chain that has a condition that matches the request is executed.
    /// Any subsequent extension chains do not execute.
    /// Limited to 5 extension chains per resource.
    pub extension_chains: std::vec::Vec<crate::model::ExtensionChain>,

    /// Required. All backend services and forwarding rules referenced by this
    /// extension must share the same load balancing scheme. Supported values:
    /// `INTERNAL_MANAGED` and `EXTERNAL_MANAGED`. For more information, refer to
    /// [Backend services
    /// overview](https://cloud.google.com/load-balancing/docs/backend-service).
    pub load_balancing_scheme: crate::model::LoadBalancingScheme,

    /// Optional. The metadata provided here is included as part of the
    /// `metadata_context` (of type `google.protobuf.Struct`) in the
    /// `ProcessingRequest` message sent to the extension server.
    ///
    /// The metadata applies to all extensions in all extensions chains in this
    /// resource.
    ///
    /// The metadata is available under the key
    /// `com.google.lb_traffic_extension.<resource_name>`.
    ///
    /// The following variables are supported in the metadata:
    ///
    /// `{forwarding_rule_id}` - substituted with the forwarding rule's fully
    /// qualified resource name.
    ///
    /// This field must not be set if at least one of the extension chains
    /// contains plugin extensions. Setting it results in a validation error.
    ///
    /// You can set metadata at either the resource level or the extension level.
    /// The extension level metadata is recommended because you can pass a
    /// different set of metadata through each extension to the backend.
    pub metadata: std::option::Option<wkt::Struct>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl LbTrafficExtension {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::LbTrafficExtension::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [create_time][crate::model::LbTrafficExtension::create_time].
    pub fn set_create_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [create_time][crate::model::LbTrafficExtension::create_time].
    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [update_time][crate::model::LbTrafficExtension::update_time].
    pub fn set_update_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_time][crate::model::LbTrafficExtension::update_time].
    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [description][crate::model::LbTrafficExtension::description].
    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.description = v.into();
        self
    }

    /// Sets the value of [labels][crate::model::LbTrafficExtension::labels].
    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<std::string::String>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }

    /// Sets the value of [forwarding_rules][crate::model::LbTrafficExtension::forwarding_rules].
    pub fn set_forwarding_rules<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.forwarding_rules = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [extension_chains][crate::model::LbTrafficExtension::extension_chains].
    pub fn set_extension_chains<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::ExtensionChain>,
    {
        use std::iter::Iterator;
        self.extension_chains = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [load_balancing_scheme][crate::model::LbTrafficExtension::load_balancing_scheme].
    pub fn set_load_balancing_scheme<T: std::convert::Into<crate::model::LoadBalancingScheme>>(
        mut self,
        v: T,
    ) -> Self {
        self.load_balancing_scheme = v.into();
        self
    }

    /// Sets the value of [metadata][crate::model::LbTrafficExtension::metadata].
    pub fn set_metadata<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Struct>,
    {
        self.metadata = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [metadata][crate::model::LbTrafficExtension::metadata].
    pub fn set_or_clear_metadata<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Struct>,
    {
        self.metadata = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for LbTrafficExtension {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.LbTrafficExtension"
    }
}

/// Message for requesting list of `LbTrafficExtension` resources.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListLbTrafficExtensionsRequest {
    /// Required. The project and location from which the `LbTrafficExtension`
    /// resources are listed. These values are specified in the following format:
    /// `projects/{project}/locations/{location}`.
    pub parent: std::string::String,

    /// Optional. Requested page size. The server might return fewer items than
    /// requested. If unspecified, the server picks an appropriate default.
    pub page_size: i32,

    /// Optional. A token identifying a page of results that the server returns.
    pub page_token: std::string::String,

    /// Optional. Filtering results.
    pub filter: std::string::String,

    /// Optional. Hint about how to order the results.
    pub order_by: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListLbTrafficExtensionsRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::ListLbTrafficExtensionsRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [page_size][crate::model::ListLbTrafficExtensionsRequest::page_size].
    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.page_size = v.into();
        self
    }

    /// Sets the value of [page_token][crate::model::ListLbTrafficExtensionsRequest::page_token].
    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.page_token = v.into();
        self
    }

    /// Sets the value of [filter][crate::model::ListLbTrafficExtensionsRequest::filter].
    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.filter = v.into();
        self
    }

    /// Sets the value of [order_by][crate::model::ListLbTrafficExtensionsRequest::order_by].
    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.order_by = v.into();
        self
    }
}

impl wkt::message::Message for ListLbTrafficExtensionsRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.ListLbTrafficExtensionsRequest"
    }
}

/// Message for response to listing `LbTrafficExtension` resources.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListLbTrafficExtensionsResponse {
    /// The list of `LbTrafficExtension` resources.
    pub lb_traffic_extensions: std::vec::Vec<crate::model::LbTrafficExtension>,

    /// A token identifying a page of results that the server returns.
    pub next_page_token: std::string::String,

    /// Locations that could not be reached.
    pub unreachable: std::vec::Vec<std::string::String>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListLbTrafficExtensionsResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [lb_traffic_extensions][crate::model::ListLbTrafficExtensionsResponse::lb_traffic_extensions].
    pub fn set_lb_traffic_extensions<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::LbTrafficExtension>,
    {
        use std::iter::Iterator;
        self.lb_traffic_extensions = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [next_page_token][crate::model::ListLbTrafficExtensionsResponse::next_page_token].
    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.next_page_token = v.into();
        self
    }

    /// Sets the value of [unreachable][crate::model::ListLbTrafficExtensionsResponse::unreachable].
    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.unreachable = v.into_iter().map(|i| i.into()).collect();
        self
    }
}

impl wkt::message::Message for ListLbTrafficExtensionsResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.ListLbTrafficExtensionsResponse"
    }
}

#[doc(hidden)]
impl gax::paginator::internal::PageableResponse for ListLbTrafficExtensionsResponse {
    type PageItem = crate::model::LbTrafficExtension;

    fn items(self) -> std::vec::Vec<Self::PageItem> {
        self.lb_traffic_extensions
    }

    fn next_page_token(&self) -> std::string::String {
        use std::clone::Clone;
        self.next_page_token.clone()
    }
}

/// Message for getting a `LbTrafficExtension` resource.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetLbTrafficExtensionRequest {
    /// Required. A name of the `LbTrafficExtension` resource to get. Must be in
    /// the format
    /// `projects/{project}/locations/{location}/lbTrafficExtensions/{lb_traffic_extension}`.
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GetLbTrafficExtensionRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::GetLbTrafficExtensionRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for GetLbTrafficExtensionRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.GetLbTrafficExtensionRequest"
    }
}

/// Message for creating a `LbTrafficExtension` resource.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateLbTrafficExtensionRequest {
    /// Required. The parent resource of the `LbTrafficExtension` resource. Must be
    /// in the format `projects/{project}/locations/{location}`.
    pub parent: std::string::String,

    /// Required. User-provided ID of the `LbTrafficExtension` resource to be
    /// created.
    pub lb_traffic_extension_id: std::string::String,

    /// Required. `LbTrafficExtension` resource to be created.
    pub lb_traffic_extension: std::option::Option<crate::model::LbTrafficExtension>,

    /// Optional. An optional request ID to identify requests. Specify a unique
    /// request ID so that if you must retry your request, the server can ignore
    /// the request if it has already been completed. The server guarantees
    /// that for 60 minutes since the first request.
    ///
    /// For example, consider a situation where you make an initial request and the
    /// request times out. If you make the request again with the same request
    /// ID, the server ignores the second request This prevents
    /// clients from accidentally creating duplicate commitments.
    ///
    /// The request ID must be a valid UUID with the exception that zero UUID is
    /// not supported (00000000-0000-0000-0000-000000000000).
    pub request_id: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl CreateLbTrafficExtensionRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::CreateLbTrafficExtensionRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [lb_traffic_extension_id][crate::model::CreateLbTrafficExtensionRequest::lb_traffic_extension_id].
    pub fn set_lb_traffic_extension_id<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.lb_traffic_extension_id = v.into();
        self
    }

    /// Sets the value of [lb_traffic_extension][crate::model::CreateLbTrafficExtensionRequest::lb_traffic_extension].
    pub fn set_lb_traffic_extension<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::LbTrafficExtension>,
    {
        self.lb_traffic_extension = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [lb_traffic_extension][crate::model::CreateLbTrafficExtensionRequest::lb_traffic_extension].
    pub fn set_or_clear_lb_traffic_extension<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::LbTrafficExtension>,
    {
        self.lb_traffic_extension = v.map(|x| x.into());
        self
    }

    /// Sets the value of [request_id][crate::model::CreateLbTrafficExtensionRequest::request_id].
    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.request_id = v.into();
        self
    }
}

impl wkt::message::Message for CreateLbTrafficExtensionRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.CreateLbTrafficExtensionRequest"
    }
}

/// Message for updating a `LbTrafficExtension` resource.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateLbTrafficExtensionRequest {
    /// Optional. Used to specify the fields to be overwritten in the
    /// `LbTrafficExtension` resource by the update.
    /// The fields specified in the `update_mask` are relative to the resource, not
    /// the full request. A field is overwritten if it is in the mask. If the
    /// user does not specify a mask, then all fields are overwritten.
    pub update_mask: std::option::Option<wkt::FieldMask>,

    /// Required. `LbTrafficExtension` resource being updated.
    pub lb_traffic_extension: std::option::Option<crate::model::LbTrafficExtension>,

    /// Optional. An optional request ID to identify requests. Specify a unique
    /// request ID so that if you must retry your request, the server can ignore
    /// the request if it has already been completed. The server guarantees
    /// that for 60 minutes since the first request.
    ///
    /// For example, consider a situation where you make an initial request and the
    /// request times out. If you make the request again with the same request
    /// ID, the server ignores the second request This prevents
    /// clients from accidentally creating duplicate commitments.
    ///
    /// The request ID must be a valid UUID with the exception that zero UUID is
    /// not supported (00000000-0000-0000-0000-000000000000).
    pub request_id: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl UpdateLbTrafficExtensionRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [update_mask][crate::model::UpdateLbTrafficExtensionRequest::update_mask].
    pub fn set_update_mask<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_mask][crate::model::UpdateLbTrafficExtensionRequest::update_mask].
    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = v.map(|x| x.into());
        self
    }

    /// Sets the value of [lb_traffic_extension][crate::model::UpdateLbTrafficExtensionRequest::lb_traffic_extension].
    pub fn set_lb_traffic_extension<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::LbTrafficExtension>,
    {
        self.lb_traffic_extension = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [lb_traffic_extension][crate::model::UpdateLbTrafficExtensionRequest::lb_traffic_extension].
    pub fn set_or_clear_lb_traffic_extension<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::LbTrafficExtension>,
    {
        self.lb_traffic_extension = v.map(|x| x.into());
        self
    }

    /// Sets the value of [request_id][crate::model::UpdateLbTrafficExtensionRequest::request_id].
    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.request_id = v.into();
        self
    }
}

impl wkt::message::Message for UpdateLbTrafficExtensionRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.UpdateLbTrafficExtensionRequest"
    }
}

/// Message for deleting a `LbTrafficExtension` resource.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteLbTrafficExtensionRequest {
    /// Required. The name of the `LbTrafficExtension` resource to delete. Must be
    /// in the format
    /// `projects/{project}/locations/{location}/lbTrafficExtensions/{lb_traffic_extension}`.
    pub name: std::string::String,

    /// Optional. An optional request ID to identify requests. Specify a unique
    /// request ID so that if you must retry your request, the server can ignore
    /// the request if it has already been completed. The server guarantees
    /// that for 60 minutes after the first request.
    ///
    /// For example, consider a situation where you make an initial request and the
    /// request times out. If you make the request again with the same request
    /// ID, the server ignores the second request This prevents
    /// clients from accidentally creating duplicate commitments.
    ///
    /// The request ID must be a valid UUID with the exception that zero UUID is
    /// not supported (00000000-0000-0000-0000-000000000000).
    pub request_id: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl DeleteLbTrafficExtensionRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::DeleteLbTrafficExtensionRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [request_id][crate::model::DeleteLbTrafficExtensionRequest::request_id].
    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.request_id = v.into();
        self
    }
}

impl wkt::message::Message for DeleteLbTrafficExtensionRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.DeleteLbTrafficExtensionRequest"
    }
}

/// `LbRouteExtension` is a resource that lets you control where traffic is
/// routed to for a given request.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct LbRouteExtension {
    /// Required. Identifier. Name of the `LbRouteExtension` resource in the
    /// following format:
    /// `projects/{project}/locations/{location}/lbRouteExtensions/{lb_route_extension}`.
    pub name: std::string::String,

    /// Output only. The timestamp when the resource was created.
    pub create_time: std::option::Option<wkt::Timestamp>,

    /// Output only. The timestamp when the resource was updated.
    pub update_time: std::option::Option<wkt::Timestamp>,

    /// Optional. A human-readable description of the resource.
    pub description: std::string::String,

    /// Optional. Set of labels associated with the `LbRouteExtension` resource.
    ///
    /// The format must comply with [the requirements for
    /// labels](https://cloud.google.com/compute/docs/labeling-resources#requirements)
    /// for Google Cloud resources.
    pub labels: std::collections::HashMap<std::string::String, std::string::String>,

    /// Required. A list of references to the forwarding rules to which this
    /// service extension is attached. At least one forwarding rule is required.
    /// Only one `LbRouteExtension` resource can be associated with a forwarding
    /// rule.
    pub forwarding_rules: std::vec::Vec<std::string::String>,

    /// Required. A set of ordered extension chains that contain the match
    /// conditions and extensions to execute. Match conditions for each extension
    /// chain are evaluated in sequence for a given request. The first extension
    /// chain that has a condition that matches the request is executed.
    /// Any subsequent extension chains do not execute.
    /// Limited to 5 extension chains per resource.
    pub extension_chains: std::vec::Vec<crate::model::ExtensionChain>,

    /// Required. All backend services and forwarding rules referenced by this
    /// extension must share the same load balancing scheme. Supported values:
    /// `INTERNAL_MANAGED`, `EXTERNAL_MANAGED`. For more information, refer to
    /// [Backend services
    /// overview](https://cloud.google.com/load-balancing/docs/backend-service).
    pub load_balancing_scheme: crate::model::LoadBalancingScheme,

    /// Optional. The metadata provided here is included as part of the
    /// `metadata_context` (of type `google.protobuf.Struct`) in the
    /// `ProcessingRequest` message sent to the extension server.
    ///
    /// The metadata applies to all extensions in all extensions chains in this
    /// resource.
    ///
    /// The metadata is available under the key
    /// `com.google.lb_route_extension.<resource_name>`.
    ///
    /// The following variables are supported in the metadata:
    ///
    /// `{forwarding_rule_id}` - substituted with the forwarding rule's fully
    /// qualified resource name.
    ///
    /// This field must not be set if at least one of the extension chains
    /// contains plugin extensions. Setting it results in a validation error.
    ///
    /// You can set metadata at either the resource level or the extension level.
    /// The extension level metadata is recommended because you can pass a
    /// different set of metadata through each extension to the backend.
    pub metadata: std::option::Option<wkt::Struct>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl LbRouteExtension {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::LbRouteExtension::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [create_time][crate::model::LbRouteExtension::create_time].
    pub fn set_create_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [create_time][crate::model::LbRouteExtension::create_time].
    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [update_time][crate::model::LbRouteExtension::update_time].
    pub fn set_update_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_time][crate::model::LbRouteExtension::update_time].
    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [description][crate::model::LbRouteExtension::description].
    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.description = v.into();
        self
    }

    /// Sets the value of [labels][crate::model::LbRouteExtension::labels].
    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<std::string::String>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }

    /// Sets the value of [forwarding_rules][crate::model::LbRouteExtension::forwarding_rules].
    pub fn set_forwarding_rules<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.forwarding_rules = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [extension_chains][crate::model::LbRouteExtension::extension_chains].
    pub fn set_extension_chains<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::ExtensionChain>,
    {
        use std::iter::Iterator;
        self.extension_chains = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [load_balancing_scheme][crate::model::LbRouteExtension::load_balancing_scheme].
    pub fn set_load_balancing_scheme<T: std::convert::Into<crate::model::LoadBalancingScheme>>(
        mut self,
        v: T,
    ) -> Self {
        self.load_balancing_scheme = v.into();
        self
    }

    /// Sets the value of [metadata][crate::model::LbRouteExtension::metadata].
    pub fn set_metadata<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Struct>,
    {
        self.metadata = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [metadata][crate::model::LbRouteExtension::metadata].
    pub fn set_or_clear_metadata<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Struct>,
    {
        self.metadata = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for LbRouteExtension {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.LbRouteExtension"
    }
}

/// Message for requesting list of `LbRouteExtension` resources.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListLbRouteExtensionsRequest {
    /// Required. The project and location from which the `LbRouteExtension`
    /// resources are listed. These values are specified in the following format:
    /// `projects/{project}/locations/{location}`.
    pub parent: std::string::String,

    /// Optional. Requested page size. The server might return fewer items than
    /// requested. If unspecified, the server picks an appropriate default.
    pub page_size: i32,

    /// Optional. A token identifying a page of results that the server returns.
    pub page_token: std::string::String,

    /// Optional. Filtering results.
    pub filter: std::string::String,

    /// Optional. Hint about how to order the results.
    pub order_by: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListLbRouteExtensionsRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::ListLbRouteExtensionsRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [page_size][crate::model::ListLbRouteExtensionsRequest::page_size].
    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.page_size = v.into();
        self
    }

    /// Sets the value of [page_token][crate::model::ListLbRouteExtensionsRequest::page_token].
    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.page_token = v.into();
        self
    }

    /// Sets the value of [filter][crate::model::ListLbRouteExtensionsRequest::filter].
    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.filter = v.into();
        self
    }

    /// Sets the value of [order_by][crate::model::ListLbRouteExtensionsRequest::order_by].
    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.order_by = v.into();
        self
    }
}

impl wkt::message::Message for ListLbRouteExtensionsRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.ListLbRouteExtensionsRequest"
    }
}

/// Message for response to listing `LbRouteExtension` resources.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListLbRouteExtensionsResponse {
    /// The list of `LbRouteExtension` resources.
    pub lb_route_extensions: std::vec::Vec<crate::model::LbRouteExtension>,

    /// A token identifying a page of results that the server returns.
    pub next_page_token: std::string::String,

    /// Locations that could not be reached.
    pub unreachable: std::vec::Vec<std::string::String>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListLbRouteExtensionsResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [lb_route_extensions][crate::model::ListLbRouteExtensionsResponse::lb_route_extensions].
    pub fn set_lb_route_extensions<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::LbRouteExtension>,
    {
        use std::iter::Iterator;
        self.lb_route_extensions = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [next_page_token][crate::model::ListLbRouteExtensionsResponse::next_page_token].
    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.next_page_token = v.into();
        self
    }

    /// Sets the value of [unreachable][crate::model::ListLbRouteExtensionsResponse::unreachable].
    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.unreachable = v.into_iter().map(|i| i.into()).collect();
        self
    }
}

impl wkt::message::Message for ListLbRouteExtensionsResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.ListLbRouteExtensionsResponse"
    }
}

#[doc(hidden)]
impl gax::paginator::internal::PageableResponse for ListLbRouteExtensionsResponse {
    type PageItem = crate::model::LbRouteExtension;

    fn items(self) -> std::vec::Vec<Self::PageItem> {
        self.lb_route_extensions
    }

    fn next_page_token(&self) -> std::string::String {
        use std::clone::Clone;
        self.next_page_token.clone()
    }
}

/// Message for getting a `LbRouteExtension` resource.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetLbRouteExtensionRequest {
    /// Required. A name of the `LbRouteExtension` resource to get. Must be in the
    /// format
    /// `projects/{project}/locations/{location}/lbRouteExtensions/{lb_route_extension}`.
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GetLbRouteExtensionRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::GetLbRouteExtensionRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for GetLbRouteExtensionRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.GetLbRouteExtensionRequest"
    }
}

/// Message for creating a `LbRouteExtension` resource.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateLbRouteExtensionRequest {
    /// Required. The parent resource of the `LbRouteExtension` resource. Must be
    /// in the format `projects/{project}/locations/{location}`.
    pub parent: std::string::String,

    /// Required. User-provided ID of the `LbRouteExtension` resource to be
    /// created.
    pub lb_route_extension_id: std::string::String,

    /// Required. `LbRouteExtension` resource to be created.
    pub lb_route_extension: std::option::Option<crate::model::LbRouteExtension>,

    /// Optional. An optional request ID to identify requests. Specify a unique
    /// request ID so that if you must retry your request, the server can ignore
    /// the request if it has already been completed. The server guarantees
    /// that for 60 minutes since the first request.
    ///
    /// For example, consider a situation where you make an initial request and the
    /// request times out. If you make the request again with the same request
    /// ID, the server ignores the second request This prevents
    /// clients from accidentally creating duplicate commitments.
    ///
    /// The request ID must be a valid UUID with the exception that zero UUID is
    /// not supported (00000000-0000-0000-0000-000000000000).
    pub request_id: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl CreateLbRouteExtensionRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::CreateLbRouteExtensionRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [lb_route_extension_id][crate::model::CreateLbRouteExtensionRequest::lb_route_extension_id].
    pub fn set_lb_route_extension_id<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.lb_route_extension_id = v.into();
        self
    }

    /// Sets the value of [lb_route_extension][crate::model::CreateLbRouteExtensionRequest::lb_route_extension].
    pub fn set_lb_route_extension<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::LbRouteExtension>,
    {
        self.lb_route_extension = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [lb_route_extension][crate::model::CreateLbRouteExtensionRequest::lb_route_extension].
    pub fn set_or_clear_lb_route_extension<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::LbRouteExtension>,
    {
        self.lb_route_extension = v.map(|x| x.into());
        self
    }

    /// Sets the value of [request_id][crate::model::CreateLbRouteExtensionRequest::request_id].
    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.request_id = v.into();
        self
    }
}

impl wkt::message::Message for CreateLbRouteExtensionRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.CreateLbRouteExtensionRequest"
    }
}

/// Message for updating a `LbRouteExtension` resource.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateLbRouteExtensionRequest {
    /// Optional. Used to specify the fields to be overwritten in the
    /// `LbRouteExtension` resource by the update.
    /// The fields specified in the `update_mask` are relative to the resource, not
    /// the full request. A field is overwritten if it is in the mask. If the
    /// user does not specify a mask, then all fields are overwritten.
    pub update_mask: std::option::Option<wkt::FieldMask>,

    /// Required. `LbRouteExtension` resource being updated.
    pub lb_route_extension: std::option::Option<crate::model::LbRouteExtension>,

    /// Optional. An optional request ID to identify requests. Specify a unique
    /// request ID so that if you must retry your request, the server can ignore
    /// the request if it has already been completed. The server guarantees
    /// that for 60 minutes since the first request.
    ///
    /// For example, consider a situation where you make an initial request and the
    /// request times out. If you make the request again with the same request
    /// ID, the server ignores the second request This prevents
    /// clients from accidentally creating duplicate commitments.
    ///
    /// The request ID must be a valid UUID with the exception that zero UUID is
    /// not supported (00000000-0000-0000-0000-000000000000).
    pub request_id: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl UpdateLbRouteExtensionRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [update_mask][crate::model::UpdateLbRouteExtensionRequest::update_mask].
    pub fn set_update_mask<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_mask][crate::model::UpdateLbRouteExtensionRequest::update_mask].
    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = v.map(|x| x.into());
        self
    }

    /// Sets the value of [lb_route_extension][crate::model::UpdateLbRouteExtensionRequest::lb_route_extension].
    pub fn set_lb_route_extension<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::LbRouteExtension>,
    {
        self.lb_route_extension = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [lb_route_extension][crate::model::UpdateLbRouteExtensionRequest::lb_route_extension].
    pub fn set_or_clear_lb_route_extension<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::LbRouteExtension>,
    {
        self.lb_route_extension = v.map(|x| x.into());
        self
    }

    /// Sets the value of [request_id][crate::model::UpdateLbRouteExtensionRequest::request_id].
    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.request_id = v.into();
        self
    }
}

impl wkt::message::Message for UpdateLbRouteExtensionRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.UpdateLbRouteExtensionRequest"
    }
}

/// Message for deleting a `LbRouteExtension` resource.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteLbRouteExtensionRequest {
    /// Required. The name of the `LbRouteExtension` resource to delete. Must be in
    /// the format
    /// `projects/{project}/locations/{location}/lbRouteExtensions/{lb_route_extension}`.
    pub name: std::string::String,

    /// Optional. An optional request ID to identify requests. Specify a unique
    /// request ID so that if you must retry your request, the server can ignore
    /// the request if it has already been completed. The server guarantees
    /// that for 60 minutes after the first request.
    ///
    /// For example, consider a situation where you make an initial request and the
    /// request times out. If you make the request again with the same request
    /// ID, the server ignores the second request This prevents
    /// clients from accidentally creating duplicate commitments.
    ///
    /// The request ID must be a valid UUID with the exception that zero UUID is
    /// not supported (00000000-0000-0000-0000-000000000000).
    pub request_id: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl DeleteLbRouteExtensionRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::DeleteLbRouteExtensionRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [request_id][crate::model::DeleteLbRouteExtensionRequest::request_id].
    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.request_id = v.into();
        self
    }
}

impl wkt::message::Message for DeleteLbRouteExtensionRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.DeleteLbRouteExtensionRequest"
    }
}

/// `LbEdgeExtension` is a resource that lets the extension service influence
/// the selection of backend services and Cloud CDN cache keys by modifying
/// request headers.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct LbEdgeExtension {
    /// Required. Identifier. Name of the `LbEdgeExtension` resource in the
    /// following format:
    /// `projects/{project}/locations/{location}/lbEdgeExtensions/{lb_edge_extension}`.
    pub name: std::string::String,

    /// Output only. The timestamp when the resource was created.
    pub create_time: std::option::Option<wkt::Timestamp>,

    /// Output only. The timestamp when the resource was updated.
    pub update_time: std::option::Option<wkt::Timestamp>,

    /// Optional. A human-readable description of the resource.
    pub description: std::string::String,

    /// Optional. Set of labels associated with the `LbEdgeExtension` resource.
    ///
    /// The format must comply with [the requirements for
    /// labels](https://cloud.google.com/compute/docs/labeling-resources#requirements)
    /// for Google Cloud resources.
    pub labels: std::collections::HashMap<std::string::String, std::string::String>,

    /// Required. A list of references to the forwarding rules to which this
    /// service extension is attached. At least one forwarding rule is required.
    /// Only one `LbEdgeExtension` resource can be associated with a forwarding
    /// rule.
    pub forwarding_rules: std::vec::Vec<std::string::String>,

    /// Required. A set of ordered extension chains that contain the match
    /// conditions and extensions to execute. Match conditions for each extension
    /// chain are evaluated in sequence for a given request. The first extension
    /// chain that has a condition that matches the request is executed.
    /// Any subsequent extension chains do not execute.
    /// Limited to 5 extension chains per resource.
    pub extension_chains: std::vec::Vec<crate::model::ExtensionChain>,

    /// Required. All forwarding rules referenced by this extension must
    /// share the same load balancing scheme.
    /// Supported values: `EXTERNAL_MANAGED`.
    pub load_balancing_scheme: crate::model::LoadBalancingScheme,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl LbEdgeExtension {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::LbEdgeExtension::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [create_time][crate::model::LbEdgeExtension::create_time].
    pub fn set_create_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [create_time][crate::model::LbEdgeExtension::create_time].
    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [update_time][crate::model::LbEdgeExtension::update_time].
    pub fn set_update_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_time][crate::model::LbEdgeExtension::update_time].
    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [description][crate::model::LbEdgeExtension::description].
    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.description = v.into();
        self
    }

    /// Sets the value of [labels][crate::model::LbEdgeExtension::labels].
    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<std::string::String>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }

    /// Sets the value of [forwarding_rules][crate::model::LbEdgeExtension::forwarding_rules].
    pub fn set_forwarding_rules<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.forwarding_rules = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [extension_chains][crate::model::LbEdgeExtension::extension_chains].
    pub fn set_extension_chains<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::ExtensionChain>,
    {
        use std::iter::Iterator;
        self.extension_chains = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [load_balancing_scheme][crate::model::LbEdgeExtension::load_balancing_scheme].
    pub fn set_load_balancing_scheme<T: std::convert::Into<crate::model::LoadBalancingScheme>>(
        mut self,
        v: T,
    ) -> Self {
        self.load_balancing_scheme = v.into();
        self
    }
}

impl wkt::message::Message for LbEdgeExtension {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.LbEdgeExtension"
    }
}

/// Message for requesting list of `LbEdgeExtension` resources.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListLbEdgeExtensionsRequest {
    /// Required. The project and location from which the `LbEdgeExtension`
    /// resources are listed. These values are specified in the following format:
    /// `projects/{project}/locations/{location}`.
    pub parent: std::string::String,

    /// Optional. Requested page size. The server might return fewer items than
    /// requested. If unspecified, the server picks an appropriate default.
    pub page_size: i32,

    /// Optional. A token identifying a page of results that the server returns.
    pub page_token: std::string::String,

    /// Optional. Filtering results.
    pub filter: std::string::String,

    /// Optional. Hint about how to order the results.
    pub order_by: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListLbEdgeExtensionsRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::ListLbEdgeExtensionsRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [page_size][crate::model::ListLbEdgeExtensionsRequest::page_size].
    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.page_size = v.into();
        self
    }

    /// Sets the value of [page_token][crate::model::ListLbEdgeExtensionsRequest::page_token].
    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.page_token = v.into();
        self
    }

    /// Sets the value of [filter][crate::model::ListLbEdgeExtensionsRequest::filter].
    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.filter = v.into();
        self
    }

    /// Sets the value of [order_by][crate::model::ListLbEdgeExtensionsRequest::order_by].
    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.order_by = v.into();
        self
    }
}

impl wkt::message::Message for ListLbEdgeExtensionsRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.ListLbEdgeExtensionsRequest"
    }
}

/// Message for response to listing `LbEdgeExtension` resources.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListLbEdgeExtensionsResponse {
    /// The list of `LbEdgeExtension` resources.
    pub lb_edge_extensions: std::vec::Vec<crate::model::LbEdgeExtension>,

    /// A token identifying a page of results that the server returns.
    pub next_page_token: std::string::String,

    /// Locations that could not be reached.
    pub unreachable: std::vec::Vec<std::string::String>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListLbEdgeExtensionsResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [lb_edge_extensions][crate::model::ListLbEdgeExtensionsResponse::lb_edge_extensions].
    pub fn set_lb_edge_extensions<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::LbEdgeExtension>,
    {
        use std::iter::Iterator;
        self.lb_edge_extensions = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [next_page_token][crate::model::ListLbEdgeExtensionsResponse::next_page_token].
    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.next_page_token = v.into();
        self
    }

    /// Sets the value of [unreachable][crate::model::ListLbEdgeExtensionsResponse::unreachable].
    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.unreachable = v.into_iter().map(|i| i.into()).collect();
        self
    }
}

impl wkt::message::Message for ListLbEdgeExtensionsResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.ListLbEdgeExtensionsResponse"
    }
}

#[doc(hidden)]
impl gax::paginator::internal::PageableResponse for ListLbEdgeExtensionsResponse {
    type PageItem = crate::model::LbEdgeExtension;

    fn items(self) -> std::vec::Vec<Self::PageItem> {
        self.lb_edge_extensions
    }

    fn next_page_token(&self) -> std::string::String {
        use std::clone::Clone;
        self.next_page_token.clone()
    }
}

/// Message for getting a `LbEdgeExtension` resource.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetLbEdgeExtensionRequest {
    /// Required. A name of the `LbEdgeExtension` resource to get. Must be in the
    /// format
    /// `projects/{project}/locations/{location}/lbEdgeExtensions/{lb_edge_extension}`.
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GetLbEdgeExtensionRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::GetLbEdgeExtensionRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for GetLbEdgeExtensionRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.GetLbEdgeExtensionRequest"
    }
}

/// Message for creating a `LbEdgeExtension` resource.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateLbEdgeExtensionRequest {
    /// Required. The parent resource of the `LbEdgeExtension` resource. Must be in
    /// the format `projects/{project}/locations/{location}`.
    pub parent: std::string::String,

    /// Required. User-provided ID of the `LbEdgeExtension` resource to be created.
    pub lb_edge_extension_id: std::string::String,

    /// Required. `LbEdgeExtension` resource to be created.
    pub lb_edge_extension: std::option::Option<crate::model::LbEdgeExtension>,

    /// Optional. An optional request ID to identify requests. Specify a unique
    /// request ID so that if you must retry your request, the server can ignore
    /// the request if it has already been completed. The server guarantees
    /// that for 60 minutes since the first request.
    ///
    /// For example, consider a situation where you make an initial request and the
    /// request times out. If you make the request again with the same request
    /// ID, the server ignores the second request This prevents
    /// clients from accidentally creating duplicate commitments.
    ///
    /// The request ID must be a valid UUID with the exception that zero UUID is
    /// not supported (00000000-0000-0000-0000-000000000000).
    pub request_id: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl CreateLbEdgeExtensionRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::CreateLbEdgeExtensionRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [lb_edge_extension_id][crate::model::CreateLbEdgeExtensionRequest::lb_edge_extension_id].
    pub fn set_lb_edge_extension_id<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.lb_edge_extension_id = v.into();
        self
    }

    /// Sets the value of [lb_edge_extension][crate::model::CreateLbEdgeExtensionRequest::lb_edge_extension].
    pub fn set_lb_edge_extension<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::LbEdgeExtension>,
    {
        self.lb_edge_extension = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [lb_edge_extension][crate::model::CreateLbEdgeExtensionRequest::lb_edge_extension].
    pub fn set_or_clear_lb_edge_extension<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::LbEdgeExtension>,
    {
        self.lb_edge_extension = v.map(|x| x.into());
        self
    }

    /// Sets the value of [request_id][crate::model::CreateLbEdgeExtensionRequest::request_id].
    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.request_id = v.into();
        self
    }
}

impl wkt::message::Message for CreateLbEdgeExtensionRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.CreateLbEdgeExtensionRequest"
    }
}

/// Message for updating a `LbEdgeExtension` resource.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateLbEdgeExtensionRequest {
    /// Optional. Used to specify the fields to be overwritten in the
    /// `LbEdgeExtension` resource by the update.
    /// The fields specified in the `update_mask` are relative to the resource, not
    /// the full request. A field is overwritten if it is in the mask. If the
    /// user does not specify a mask, then all fields are overwritten.
    pub update_mask: std::option::Option<wkt::FieldMask>,

    /// Required. `LbEdgeExtension` resource being updated.
    pub lb_edge_extension: std::option::Option<crate::model::LbEdgeExtension>,

    /// Optional. An optional request ID to identify requests. Specify a unique
    /// request ID so that if you must retry your request, the server can ignore
    /// the request if it has already been completed. The server guarantees
    /// that for 60 minutes since the first request.
    ///
    /// For example, consider a situation where you make an initial request and the
    /// request times out. If you make the request again with the same request
    /// ID, the server ignores the second request This prevents
    /// clients from accidentally creating duplicate commitments.
    ///
    /// The request ID must be a valid UUID with the exception that zero UUID is
    /// not supported (00000000-0000-0000-0000-000000000000).
    pub request_id: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl UpdateLbEdgeExtensionRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [update_mask][crate::model::UpdateLbEdgeExtensionRequest::update_mask].
    pub fn set_update_mask<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_mask][crate::model::UpdateLbEdgeExtensionRequest::update_mask].
    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = v.map(|x| x.into());
        self
    }

    /// Sets the value of [lb_edge_extension][crate::model::UpdateLbEdgeExtensionRequest::lb_edge_extension].
    pub fn set_lb_edge_extension<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::LbEdgeExtension>,
    {
        self.lb_edge_extension = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [lb_edge_extension][crate::model::UpdateLbEdgeExtensionRequest::lb_edge_extension].
    pub fn set_or_clear_lb_edge_extension<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::LbEdgeExtension>,
    {
        self.lb_edge_extension = v.map(|x| x.into());
        self
    }

    /// Sets the value of [request_id][crate::model::UpdateLbEdgeExtensionRequest::request_id].
    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.request_id = v.into();
        self
    }
}

impl wkt::message::Message for UpdateLbEdgeExtensionRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.UpdateLbEdgeExtensionRequest"
    }
}

/// Message for deleting a `LbEdgeExtension` resource.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteLbEdgeExtensionRequest {
    /// Required. The name of the `LbEdgeExtension` resource to delete. Must be in
    /// the format
    /// `projects/{project}/locations/{location}/lbEdgeExtensions/{lb_edge_extension}`.
    pub name: std::string::String,

    /// Optional. An optional request ID to identify requests. Specify a unique
    /// request ID so that if you must retry your request, the server can ignore
    /// the request if it has already been completed. The server guarantees
    /// that for 60 minutes after the first request.
    ///
    /// For example, consider a situation where you make an initial request and the
    /// request times out. If you make the request again with the same request
    /// ID, the server ignores the second request This prevents
    /// clients from accidentally creating duplicate commitments.
    ///
    /// The request ID must be a valid UUID with the exception that zero UUID is
    /// not supported (00000000-0000-0000-0000-000000000000).
    pub request_id: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl DeleteLbEdgeExtensionRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::DeleteLbEdgeExtensionRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [request_id][crate::model::DeleteLbEdgeExtensionRequest::request_id].
    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.request_id = v.into();
        self
    }
}

impl wkt::message::Message for DeleteLbEdgeExtensionRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.DeleteLbEdgeExtensionRequest"
    }
}

/// `AuthzExtension` is a resource that allows traffic forwarding
/// to a callout backend service to make an authorization decision.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct AuthzExtension {
    /// Required. Identifier. Name of the `AuthzExtension` resource in the
    /// following format:
    /// `projects/{project}/locations/{location}/authzExtensions/{authz_extension}`.
    pub name: std::string::String,

    /// Output only. The timestamp when the resource was created.
    pub create_time: std::option::Option<wkt::Timestamp>,

    /// Output only. The timestamp when the resource was updated.
    pub update_time: std::option::Option<wkt::Timestamp>,

    /// Optional. A human-readable description of the resource.
    pub description: std::string::String,

    /// Optional. Set of labels associated with the `AuthzExtension`
    /// resource.
    ///
    /// The format must comply with [the requirements for
    /// labels](/compute/docs/labeling-resources#requirements) for Google Cloud
    /// resources.
    pub labels: std::collections::HashMap<std::string::String, std::string::String>,

    /// Required. All backend services and forwarding rules referenced by this
    /// extension must share the same load balancing scheme. Supported values:
    /// `INTERNAL_MANAGED`, `EXTERNAL_MANAGED`. For more information, refer to
    /// [Backend services
    /// overview](https://cloud.google.com/load-balancing/docs/backend-service).
    pub load_balancing_scheme: crate::model::LoadBalancingScheme,

    /// Required. The `:authority` header in the gRPC request sent from Envoy
    /// to the extension service.
    pub authority: std::string::String,

    /// Required. The reference to the service that runs the extension.
    ///
    /// To configure a callout extension, `service` must be a fully-qualified
    /// reference
    /// to a [backend
    /// service](https://cloud.google.com/compute/docs/reference/rest/v1/backendServices)
    /// in the format:
    /// `<https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/backendServices/{backendService}>`
    /// or
    /// `<https://www.googleapis.com/compute/v1/projects/{project}/global/backendServices/{backendService}>`.
    pub service: std::string::String,

    /// Required. Specifies the timeout for each individual message on the stream.
    /// The timeout must be between 10-10000 milliseconds.
    pub timeout: std::option::Option<wkt::Duration>,

    /// Optional. Determines how the proxy behaves if the call to the extension
    /// fails or times out.
    ///
    /// When set to `TRUE`, request or response processing continues without
    /// error. Any subsequent extensions in the extension chain are also
    /// executed. When set to `FALSE` or the default setting of `FALSE` is used,
    /// one of the following happens:
    ///
    /// * If response headers have not been delivered to the downstream client,
    ///   a generic 500 error is returned to the client. The error response can be
    ///   tailored by configuring a custom error response in the load balancer.
    ///
    /// * If response headers have been delivered, then the HTTP stream to the
    ///   downstream client is reset.
    ///
    pub fail_open: bool,

    /// Optional. The metadata provided here is included as part of the
    /// `metadata_context` (of type `google.protobuf.Struct`) in the
    /// `ProcessingRequest` message sent to the extension
    /// server. The metadata is available under the namespace
    /// `com.google.authz_extension.<resource_name>`.
    /// The following variables are supported in the metadata Struct:
    ///
    /// `{forwarding_rule_id}` - substituted with the forwarding rule's fully
    /// qualified resource name.
    pub metadata: std::option::Option<wkt::Struct>,

    /// Optional. List of the HTTP headers to forward to the extension
    /// (from the client). If omitted, all headers are sent.
    /// Each element is a string indicating the header name.
    pub forward_headers: std::vec::Vec<std::string::String>,

    /// Optional. The format of communication supported by the callout extension.
    /// If not specified, the default value `EXT_PROC_GRPC` is used.
    pub wire_format: crate::model::WireFormat,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl AuthzExtension {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::AuthzExtension::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [create_time][crate::model::AuthzExtension::create_time].
    pub fn set_create_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [create_time][crate::model::AuthzExtension::create_time].
    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [update_time][crate::model::AuthzExtension::update_time].
    pub fn set_update_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_time][crate::model::AuthzExtension::update_time].
    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [description][crate::model::AuthzExtension::description].
    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.description = v.into();
        self
    }

    /// Sets the value of [labels][crate::model::AuthzExtension::labels].
    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<std::string::String>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }

    /// Sets the value of [load_balancing_scheme][crate::model::AuthzExtension::load_balancing_scheme].
    pub fn set_load_balancing_scheme<T: std::convert::Into<crate::model::LoadBalancingScheme>>(
        mut self,
        v: T,
    ) -> Self {
        self.load_balancing_scheme = v.into();
        self
    }

    /// Sets the value of [authority][crate::model::AuthzExtension::authority].
    pub fn set_authority<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.authority = v.into();
        self
    }

    /// Sets the value of [service][crate::model::AuthzExtension::service].
    pub fn set_service<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.service = v.into();
        self
    }

    /// Sets the value of [timeout][crate::model::AuthzExtension::timeout].
    pub fn set_timeout<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Duration>,
    {
        self.timeout = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [timeout][crate::model::AuthzExtension::timeout].
    pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Duration>,
    {
        self.timeout = v.map(|x| x.into());
        self
    }

    /// Sets the value of [fail_open][crate::model::AuthzExtension::fail_open].
    pub fn set_fail_open<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.fail_open = v.into();
        self
    }

    /// Sets the value of [metadata][crate::model::AuthzExtension::metadata].
    pub fn set_metadata<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Struct>,
    {
        self.metadata = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [metadata][crate::model::AuthzExtension::metadata].
    pub fn set_or_clear_metadata<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Struct>,
    {
        self.metadata = v.map(|x| x.into());
        self
    }

    /// Sets the value of [forward_headers][crate::model::AuthzExtension::forward_headers].
    pub fn set_forward_headers<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.forward_headers = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [wire_format][crate::model::AuthzExtension::wire_format].
    pub fn set_wire_format<T: std::convert::Into<crate::model::WireFormat>>(
        mut self,
        v: T,
    ) -> Self {
        self.wire_format = v.into();
        self
    }
}

impl wkt::message::Message for AuthzExtension {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.AuthzExtension"
    }
}

/// Message for requesting list of `AuthzExtension` resources.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListAuthzExtensionsRequest {
    /// Required. The project and location from which the `AuthzExtension`
    /// resources are listed. These values are specified in the following format:
    /// `projects/{project}/locations/{location}`.
    pub parent: std::string::String,

    /// Optional. Requested page size. The server might return fewer items than
    /// requested. If unspecified, the server picks an appropriate default.
    pub page_size: i32,

    /// Optional. A token identifying a page of results that the server returns.
    pub page_token: std::string::String,

    /// Optional. Filtering results.
    pub filter: std::string::String,

    /// Optional. Hint about how to order the results.
    pub order_by: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListAuthzExtensionsRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::ListAuthzExtensionsRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [page_size][crate::model::ListAuthzExtensionsRequest::page_size].
    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.page_size = v.into();
        self
    }

    /// Sets the value of [page_token][crate::model::ListAuthzExtensionsRequest::page_token].
    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.page_token = v.into();
        self
    }

    /// Sets the value of [filter][crate::model::ListAuthzExtensionsRequest::filter].
    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.filter = v.into();
        self
    }

    /// Sets the value of [order_by][crate::model::ListAuthzExtensionsRequest::order_by].
    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.order_by = v.into();
        self
    }
}

impl wkt::message::Message for ListAuthzExtensionsRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.ListAuthzExtensionsRequest"
    }
}

/// Message for response to listing `AuthzExtension` resources.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListAuthzExtensionsResponse {
    /// The list of `AuthzExtension` resources.
    pub authz_extensions: std::vec::Vec<crate::model::AuthzExtension>,

    /// A token identifying a page of results that the server returns.
    pub next_page_token: std::string::String,

    /// Locations that could not be reached.
    pub unreachable: std::vec::Vec<std::string::String>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListAuthzExtensionsResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [authz_extensions][crate::model::ListAuthzExtensionsResponse::authz_extensions].
    pub fn set_authz_extensions<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::AuthzExtension>,
    {
        use std::iter::Iterator;
        self.authz_extensions = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [next_page_token][crate::model::ListAuthzExtensionsResponse::next_page_token].
    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.next_page_token = v.into();
        self
    }

    /// Sets the value of [unreachable][crate::model::ListAuthzExtensionsResponse::unreachable].
    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.unreachable = v.into_iter().map(|i| i.into()).collect();
        self
    }
}

impl wkt::message::Message for ListAuthzExtensionsResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.ListAuthzExtensionsResponse"
    }
}

#[doc(hidden)]
impl gax::paginator::internal::PageableResponse for ListAuthzExtensionsResponse {
    type PageItem = crate::model::AuthzExtension;

    fn items(self) -> std::vec::Vec<Self::PageItem> {
        self.authz_extensions
    }

    fn next_page_token(&self) -> std::string::String {
        use std::clone::Clone;
        self.next_page_token.clone()
    }
}

/// Message for getting a `AuthzExtension` resource.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetAuthzExtensionRequest {
    /// Required. A name of the `AuthzExtension` resource to get. Must be in
    /// the format
    /// `projects/{project}/locations/{location}/authzExtensions/{authz_extension}`.
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GetAuthzExtensionRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::GetAuthzExtensionRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for GetAuthzExtensionRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.GetAuthzExtensionRequest"
    }
}

/// Message for creating a `AuthzExtension` resource.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateAuthzExtensionRequest {
    /// Required. The parent resource of the `AuthzExtension` resource. Must
    /// be in the format `projects/{project}/locations/{location}`.
    pub parent: std::string::String,

    /// Required. User-provided ID of the `AuthzExtension` resource to be
    /// created.
    pub authz_extension_id: std::string::String,

    /// Required. `AuthzExtension` resource to be created.
    pub authz_extension: std::option::Option<crate::model::AuthzExtension>,

    /// Optional. An optional request ID to identify requests. Specify a unique
    /// request ID so that if you must retry your request, the server can ignore
    /// the request if it has already been completed. The server guarantees
    /// that for 60 minutes since the first request.
    ///
    /// For example, consider a situation where you make an initial request and the
    /// request times out. If you make the request again with the same request
    /// ID, the server ignores the second request This prevents
    /// clients from accidentally creating duplicate commitments.
    ///
    /// The request ID must be a valid UUID with the exception that zero UUID is
    /// not supported (00000000-0000-0000-0000-000000000000).
    pub request_id: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl CreateAuthzExtensionRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::CreateAuthzExtensionRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [authz_extension_id][crate::model::CreateAuthzExtensionRequest::authz_extension_id].
    pub fn set_authz_extension_id<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.authz_extension_id = v.into();
        self
    }

    /// Sets the value of [authz_extension][crate::model::CreateAuthzExtensionRequest::authz_extension].
    pub fn set_authz_extension<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::AuthzExtension>,
    {
        self.authz_extension = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [authz_extension][crate::model::CreateAuthzExtensionRequest::authz_extension].
    pub fn set_or_clear_authz_extension<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::AuthzExtension>,
    {
        self.authz_extension = v.map(|x| x.into());
        self
    }

    /// Sets the value of [request_id][crate::model::CreateAuthzExtensionRequest::request_id].
    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.request_id = v.into();
        self
    }
}

impl wkt::message::Message for CreateAuthzExtensionRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.CreateAuthzExtensionRequest"
    }
}

/// Message for updating a `AuthzExtension` resource.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateAuthzExtensionRequest {
    /// Required. Used to specify the fields to be overwritten in the
    /// `AuthzExtension` resource by the update.
    /// The fields specified in the `update_mask` are relative to the resource, not
    /// the full request. A field is overwritten if it is in the mask. If the
    /// user does not specify a mask, then all fields are overwritten.
    pub update_mask: std::option::Option<wkt::FieldMask>,

    /// Required. `AuthzExtension` resource being updated.
    pub authz_extension: std::option::Option<crate::model::AuthzExtension>,

    /// Optional. An optional request ID to identify requests. Specify a unique
    /// request ID so that if you must retry your request, the server can ignore
    /// the request if it has already been completed. The server guarantees
    /// that for 60 minutes since the first request.
    ///
    /// For example, consider a situation where you make an initial request and the
    /// request times out. If you make the request again with the same request
    /// ID, the server ignores the second request This prevents
    /// clients from accidentally creating duplicate commitments.
    ///
    /// The request ID must be a valid UUID with the exception that zero UUID is
    /// not supported (00000000-0000-0000-0000-000000000000).
    pub request_id: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl UpdateAuthzExtensionRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [update_mask][crate::model::UpdateAuthzExtensionRequest::update_mask].
    pub fn set_update_mask<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_mask][crate::model::UpdateAuthzExtensionRequest::update_mask].
    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = v.map(|x| x.into());
        self
    }

    /// Sets the value of [authz_extension][crate::model::UpdateAuthzExtensionRequest::authz_extension].
    pub fn set_authz_extension<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::AuthzExtension>,
    {
        self.authz_extension = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [authz_extension][crate::model::UpdateAuthzExtensionRequest::authz_extension].
    pub fn set_or_clear_authz_extension<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::AuthzExtension>,
    {
        self.authz_extension = v.map(|x| x.into());
        self
    }

    /// Sets the value of [request_id][crate::model::UpdateAuthzExtensionRequest::request_id].
    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.request_id = v.into();
        self
    }
}

impl wkt::message::Message for UpdateAuthzExtensionRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.UpdateAuthzExtensionRequest"
    }
}

/// Message for deleting a `AuthzExtension` resource.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteAuthzExtensionRequest {
    /// Required. The name of the `AuthzExtension` resource to delete. Must
    /// be in the format
    /// `projects/{project}/locations/{location}/authzExtensions/{authz_extension}`.
    pub name: std::string::String,

    /// Optional. An optional request ID to identify requests. Specify a unique
    /// request ID so that if you must retry your request, the server can ignore
    /// the request if it has already been completed. The server guarantees
    /// that for 60 minutes after the first request.
    ///
    /// For example, consider a situation where you make an initial request and the
    /// request times out. If you make the request again with the same request
    /// ID, the server ignores the second request This prevents
    /// clients from accidentally creating duplicate commitments.
    ///
    /// The request ID must be a valid UUID with the exception that zero UUID is
    /// not supported (00000000-0000-0000-0000-000000000000).
    pub request_id: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl DeleteAuthzExtensionRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::DeleteAuthzExtensionRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [request_id][crate::model::DeleteAuthzExtensionRequest::request_id].
    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.request_id = v.into();
        self
    }
}

impl wkt::message::Message for DeleteAuthzExtensionRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.DeleteAuthzExtensionRequest"
    }
}

/// EndpointPolicy is a resource that helps apply desired configuration
/// on the endpoints that match specific criteria.
/// For example, this resource can be used to apply "authentication config"
/// an all endpoints that serve on port 8080.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct EndpointPolicy {
    /// Identifier. Name of the EndpointPolicy resource. It matches pattern
    /// `projects/{project}/locations/global/endpointPolicies/{endpoint_policy}`.
    pub name: std::string::String,

    /// Output only. The timestamp when the resource was created.
    pub create_time: std::option::Option<wkt::Timestamp>,

    /// Output only. The timestamp when the resource was updated.
    pub update_time: std::option::Option<wkt::Timestamp>,

    /// Optional. Set of label tags associated with the EndpointPolicy resource.
    pub labels: std::collections::HashMap<std::string::String, std::string::String>,

    /// Required. The type of endpoint policy. This is primarily used to validate
    /// the configuration.
    pub r#type: crate::model::endpoint_policy::EndpointPolicyType,

    /// Optional. This field specifies the URL of AuthorizationPolicy resource that
    /// applies authorization policies to the inbound traffic at the
    /// matched endpoints. Refer to Authorization. If this field is not
    /// specified, authorization is disabled(no authz checks) for this
    /// endpoint.
    pub authorization_policy: std::string::String,

    /// Required. A matcher that selects endpoints to which the policies should be
    /// applied.
    pub endpoint_matcher: std::option::Option<crate::model::EndpointMatcher>,

    /// Optional. Port selector for the (matched) endpoints. If no port selector is
    /// provided, the matched config is applied to all ports.
    pub traffic_port_selector: std::option::Option<crate::model::TrafficPortSelector>,

    /// Optional. A free-text description of the resource. Max length 1024
    /// characters.
    pub description: std::string::String,

    /// Optional. A URL referring to ServerTlsPolicy resource. ServerTlsPolicy is
    /// used to determine the authentication policy to be applied to terminate the
    /// inbound traffic at the identified backends. If this field is not set,
    /// authentication is disabled(open) for this endpoint.
    pub server_tls_policy: std::string::String,

    /// Optional. A URL referring to a ClientTlsPolicy resource. ClientTlsPolicy
    /// can be set to specify the authentication for traffic from the proxy to the
    /// actual endpoints. More specifically, it is applied to the outgoing traffic
    /// from the proxy to the endpoint. This is typically used for sidecar model
    /// where the proxy identifies itself as endpoint to the control plane, with
    /// the connection between sidecar and endpoint requiring authentication. If
    /// this field is not set, authentication is disabled(open). Applicable only
    /// when EndpointPolicyType is SIDECAR_PROXY.
    pub client_tls_policy: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl EndpointPolicy {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::EndpointPolicy::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [create_time][crate::model::EndpointPolicy::create_time].
    pub fn set_create_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [create_time][crate::model::EndpointPolicy::create_time].
    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [update_time][crate::model::EndpointPolicy::update_time].
    pub fn set_update_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_time][crate::model::EndpointPolicy::update_time].
    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [labels][crate::model::EndpointPolicy::labels].
    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<std::string::String>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }

    /// Sets the value of [r#type][crate::model::EndpointPolicy::type].
    pub fn set_type<T: std::convert::Into<crate::model::endpoint_policy::EndpointPolicyType>>(
        mut self,
        v: T,
    ) -> Self {
        self.r#type = v.into();
        self
    }

    /// Sets the value of [authorization_policy][crate::model::EndpointPolicy::authorization_policy].
    pub fn set_authorization_policy<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.authorization_policy = v.into();
        self
    }

    /// Sets the value of [endpoint_matcher][crate::model::EndpointPolicy::endpoint_matcher].
    pub fn set_endpoint_matcher<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::EndpointMatcher>,
    {
        self.endpoint_matcher = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [endpoint_matcher][crate::model::EndpointPolicy::endpoint_matcher].
    pub fn set_or_clear_endpoint_matcher<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::EndpointMatcher>,
    {
        self.endpoint_matcher = v.map(|x| x.into());
        self
    }

    /// Sets the value of [traffic_port_selector][crate::model::EndpointPolicy::traffic_port_selector].
    pub fn set_traffic_port_selector<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::TrafficPortSelector>,
    {
        self.traffic_port_selector = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [traffic_port_selector][crate::model::EndpointPolicy::traffic_port_selector].
    pub fn set_or_clear_traffic_port_selector<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::TrafficPortSelector>,
    {
        self.traffic_port_selector = v.map(|x| x.into());
        self
    }

    /// Sets the value of [description][crate::model::EndpointPolicy::description].
    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.description = v.into();
        self
    }

    /// Sets the value of [server_tls_policy][crate::model::EndpointPolicy::server_tls_policy].
    pub fn set_server_tls_policy<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.server_tls_policy = v.into();
        self
    }

    /// Sets the value of [client_tls_policy][crate::model::EndpointPolicy::client_tls_policy].
    pub fn set_client_tls_policy<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.client_tls_policy = v.into();
        self
    }
}

impl wkt::message::Message for EndpointPolicy {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.EndpointPolicy"
    }
}

/// Defines additional types related to [EndpointPolicy].
pub mod endpoint_policy {
    #[allow(unused_imports)]
    use super::*;

    /// The type of endpoint policy.
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum EndpointPolicyType {
        /// Default value. Must not be used.
        Unspecified,
        /// Represents a proxy deployed as a sidecar.
        SidecarProxy,
        /// Represents a proxyless gRPC backend.
        GrpcServer,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [EndpointPolicyType::value] or
        /// [EndpointPolicyType::name].
        UnknownValue(endpoint_policy_type::UnknownValue),
    }

    #[doc(hidden)]
    pub mod endpoint_policy_type {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl EndpointPolicyType {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::SidecarProxy => std::option::Option::Some(1),
                Self::GrpcServer => std::option::Option::Some(2),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => std::option::Option::Some("ENDPOINT_POLICY_TYPE_UNSPECIFIED"),
                Self::SidecarProxy => std::option::Option::Some("SIDECAR_PROXY"),
                Self::GrpcServer => std::option::Option::Some("GRPC_SERVER"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for EndpointPolicyType {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for EndpointPolicyType {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for EndpointPolicyType {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                1 => Self::SidecarProxy,
                2 => Self::GrpcServer,
                _ => Self::UnknownValue(endpoint_policy_type::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for EndpointPolicyType {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "ENDPOINT_POLICY_TYPE_UNSPECIFIED" => Self::Unspecified,
                "SIDECAR_PROXY" => Self::SidecarProxy,
                "GRPC_SERVER" => Self::GrpcServer,
                _ => Self::UnknownValue(endpoint_policy_type::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for EndpointPolicyType {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::SidecarProxy => serializer.serialize_i32(1),
                Self::GrpcServer => serializer.serialize_i32(2),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for EndpointPolicyType {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<EndpointPolicyType>::new(
                ".google.cloud.networkservices.v1.EndpointPolicy.EndpointPolicyType",
            ))
        }
    }
}

/// Request used with the ListEndpointPolicies method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListEndpointPoliciesRequest {
    /// Required. The project and location from which the EndpointPolicies should
    /// be listed, specified in the format `projects/*/locations/global`.
    pub parent: std::string::String,

    /// Maximum number of EndpointPolicies to return per call.
    pub page_size: i32,

    /// The value returned by the last `ListEndpointPoliciesResponse`
    /// Indicates that this is a continuation of a prior
    /// `ListEndpointPolicies` call, and that the system should return the
    /// next page of data.
    pub page_token: std::string::String,

    /// Optional. If true, allow partial responses for multi-regional Aggregated
    /// List requests. Otherwise if one of the locations is down or unreachable,
    /// the Aggregated List request will fail.
    pub return_partial_success: bool,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListEndpointPoliciesRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::ListEndpointPoliciesRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [page_size][crate::model::ListEndpointPoliciesRequest::page_size].
    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.page_size = v.into();
        self
    }

    /// Sets the value of [page_token][crate::model::ListEndpointPoliciesRequest::page_token].
    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.page_token = v.into();
        self
    }

    /// Sets the value of [return_partial_success][crate::model::ListEndpointPoliciesRequest::return_partial_success].
    pub fn set_return_partial_success<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.return_partial_success = v.into();
        self
    }
}

impl wkt::message::Message for ListEndpointPoliciesRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.ListEndpointPoliciesRequest"
    }
}

/// Response returned by the ListEndpointPolicies method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListEndpointPoliciesResponse {
    /// List of EndpointPolicy resources.
    pub endpoint_policies: std::vec::Vec<crate::model::EndpointPolicy>,

    /// If there might be more results than those appearing in this response, then
    /// `next_page_token` is included. To get the next set of results, call this
    /// method again using the value of `next_page_token` as `page_token`.
    pub next_page_token: std::string::String,

    /// Unreachable resources. Populated when the request opts into
    /// [return_partial_success][google.cloud.networkservices.v1.ListEndpointPoliciesRequest.return_partial_success]
    /// and reading across collections e.g. when
    /// attempting to list all resources across all supported locations.
    ///
    /// [google.cloud.networkservices.v1.ListEndpointPoliciesRequest.return_partial_success]: crate::model::ListEndpointPoliciesRequest::return_partial_success
    pub unreachable: std::vec::Vec<std::string::String>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListEndpointPoliciesResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [endpoint_policies][crate::model::ListEndpointPoliciesResponse::endpoint_policies].
    pub fn set_endpoint_policies<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::EndpointPolicy>,
    {
        use std::iter::Iterator;
        self.endpoint_policies = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [next_page_token][crate::model::ListEndpointPoliciesResponse::next_page_token].
    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.next_page_token = v.into();
        self
    }

    /// Sets the value of [unreachable][crate::model::ListEndpointPoliciesResponse::unreachable].
    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.unreachable = v.into_iter().map(|i| i.into()).collect();
        self
    }
}

impl wkt::message::Message for ListEndpointPoliciesResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.ListEndpointPoliciesResponse"
    }
}

#[doc(hidden)]
impl gax::paginator::internal::PageableResponse for ListEndpointPoliciesResponse {
    type PageItem = crate::model::EndpointPolicy;

    fn items(self) -> std::vec::Vec<Self::PageItem> {
        self.endpoint_policies
    }

    fn next_page_token(&self) -> std::string::String {
        use std::clone::Clone;
        self.next_page_token.clone()
    }
}

/// Request used with the GetEndpointPolicy method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetEndpointPolicyRequest {
    /// Required. A name of the EndpointPolicy to get. Must be in the format
    /// `projects/*/locations/global/endpointPolicies/*`.
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GetEndpointPolicyRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::GetEndpointPolicyRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for GetEndpointPolicyRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.GetEndpointPolicyRequest"
    }
}

/// Request used with the CreateEndpointPolicy method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateEndpointPolicyRequest {
    /// Required. The parent resource of the EndpointPolicy. Must be in the
    /// format `projects/*/locations/global`.
    pub parent: std::string::String,

    /// Required. Short name of the EndpointPolicy resource to be created.
    /// E.g. "CustomECS".
    pub endpoint_policy_id: std::string::String,

    /// Required. EndpointPolicy resource to be created.
    pub endpoint_policy: std::option::Option<crate::model::EndpointPolicy>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl CreateEndpointPolicyRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::CreateEndpointPolicyRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [endpoint_policy_id][crate::model::CreateEndpointPolicyRequest::endpoint_policy_id].
    pub fn set_endpoint_policy_id<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.endpoint_policy_id = v.into();
        self
    }

    /// Sets the value of [endpoint_policy][crate::model::CreateEndpointPolicyRequest::endpoint_policy].
    pub fn set_endpoint_policy<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::EndpointPolicy>,
    {
        self.endpoint_policy = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [endpoint_policy][crate::model::CreateEndpointPolicyRequest::endpoint_policy].
    pub fn set_or_clear_endpoint_policy<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::EndpointPolicy>,
    {
        self.endpoint_policy = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for CreateEndpointPolicyRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.CreateEndpointPolicyRequest"
    }
}

/// Request used with the UpdateEndpointPolicy method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateEndpointPolicyRequest {
    /// Optional. Field mask is used to specify the fields to be overwritten in the
    /// EndpointPolicy resource by the update.
    /// The fields specified in the update_mask are relative to the resource, not
    /// the full request. A field will be overwritten if it is in the mask. If the
    /// user does not provide a mask then all fields will be overwritten.
    pub update_mask: std::option::Option<wkt::FieldMask>,

    /// Required. Updated EndpointPolicy resource.
    pub endpoint_policy: std::option::Option<crate::model::EndpointPolicy>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl UpdateEndpointPolicyRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [update_mask][crate::model::UpdateEndpointPolicyRequest::update_mask].
    pub fn set_update_mask<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_mask][crate::model::UpdateEndpointPolicyRequest::update_mask].
    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = v.map(|x| x.into());
        self
    }

    /// Sets the value of [endpoint_policy][crate::model::UpdateEndpointPolicyRequest::endpoint_policy].
    pub fn set_endpoint_policy<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::EndpointPolicy>,
    {
        self.endpoint_policy = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [endpoint_policy][crate::model::UpdateEndpointPolicyRequest::endpoint_policy].
    pub fn set_or_clear_endpoint_policy<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::EndpointPolicy>,
    {
        self.endpoint_policy = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for UpdateEndpointPolicyRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.UpdateEndpointPolicyRequest"
    }
}

/// Request used with the DeleteEndpointPolicy method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteEndpointPolicyRequest {
    /// Required. A name of the EndpointPolicy to delete. Must be in the format
    /// `projects/*/locations/global/endpointPolicies/*`.
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl DeleteEndpointPolicyRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::DeleteEndpointPolicyRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for DeleteEndpointPolicyRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.DeleteEndpointPolicyRequest"
    }
}

/// `WasmPlugin` is a resource representing a service executing
/// a customer-provided Wasm module.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct WasmPlugin {
    /// Identifier. Name of the `WasmPlugin` resource in the following format:
    /// `projects/{project}/locations/{location}/wasmPlugins/{wasm_plugin}`.
    pub name: std::string::String,

    /// Output only. The timestamp when the resource was created.
    pub create_time: std::option::Option<wkt::Timestamp>,

    /// Output only. The timestamp when the resource was updated.
    pub update_time: std::option::Option<wkt::Timestamp>,

    /// Optional. A human-readable description of the resource.
    pub description: std::string::String,

    /// Optional. Set of labels associated with the `WasmPlugin` resource.
    ///
    /// The format must comply with [the following
    /// requirements](/compute/docs/labeling-resources#requirements).
    pub labels: std::collections::HashMap<std::string::String, std::string::String>,

    /// Optional. The ID of the `WasmPluginVersion` resource that is the
    /// currently serving one. The version referred to must be a child of this
    /// `WasmPlugin` resource.
    pub main_version_id: std::string::String,

    /// Optional. Specifies the logging options for the activity performed by this
    /// plugin. If logging is enabled, plugin logs are exported to
    /// Cloud Logging.
    /// Note that the settings relate to the logs generated by using
    /// logging statements in your Wasm code.
    pub log_config: std::option::Option<crate::model::wasm_plugin::LogConfig>,

    /// Optional. All versions of this `WasmPlugin` resource in the key-value
    /// format. The key is the resource ID, and the value is the `VersionDetails`
    /// object.
    ///
    /// Lets you create or update a `WasmPlugin` resource and its versions in a
    /// single request. When the `main_version_id` field is not empty, it must
    /// point to one of the `VersionDetails` objects in the map.
    ///
    /// If provided in a `PATCH` request, the new versions replace the
    /// previous set. Any version omitted from the `versions` field is removed.
    /// Because the `WasmPluginVersion` resource is immutable, if a
    /// `WasmPluginVersion` resource with the same name already exists and differs,
    /// the request fails.
    ///
    /// Note: In a `GET` request, this field is populated only if the field
    /// `GetWasmPluginRequest.view` is set to `WASM_PLUGIN_VIEW_FULL`.
    pub versions:
        std::collections::HashMap<std::string::String, crate::model::wasm_plugin::VersionDetails>,

    /// Output only. List of all
    /// [extensions](https://cloud.google.com/service-extensions/docs/overview)
    /// that use this `WasmPlugin` resource.
    pub used_by: std::vec::Vec<crate::model::wasm_plugin::UsedBy>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl WasmPlugin {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::WasmPlugin::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [create_time][crate::model::WasmPlugin::create_time].
    pub fn set_create_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [create_time][crate::model::WasmPlugin::create_time].
    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [update_time][crate::model::WasmPlugin::update_time].
    pub fn set_update_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_time][crate::model::WasmPlugin::update_time].
    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [description][crate::model::WasmPlugin::description].
    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.description = v.into();
        self
    }

    /// Sets the value of [labels][crate::model::WasmPlugin::labels].
    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<std::string::String>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }

    /// Sets the value of [main_version_id][crate::model::WasmPlugin::main_version_id].
    pub fn set_main_version_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.main_version_id = v.into();
        self
    }

    /// Sets the value of [log_config][crate::model::WasmPlugin::log_config].
    pub fn set_log_config<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::wasm_plugin::LogConfig>,
    {
        self.log_config = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [log_config][crate::model::WasmPlugin::log_config].
    pub fn set_or_clear_log_config<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::wasm_plugin::LogConfig>,
    {
        self.log_config = v.map(|x| x.into());
        self
    }

    /// Sets the value of [versions][crate::model::WasmPlugin::versions].
    pub fn set_versions<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<std::string::String>,
        V: std::convert::Into<crate::model::wasm_plugin::VersionDetails>,
    {
        use std::iter::Iterator;
        self.versions = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }

    /// Sets the value of [used_by][crate::model::WasmPlugin::used_by].
    pub fn set_used_by<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::wasm_plugin::UsedBy>,
    {
        use std::iter::Iterator;
        self.used_by = v.into_iter().map(|i| i.into()).collect();
        self
    }
}

impl wkt::message::Message for WasmPlugin {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.WasmPlugin"
    }
}

/// Defines additional types related to [WasmPlugin].
pub mod wasm_plugin {
    #[allow(unused_imports)]
    use super::*;

    /// Details of a `WasmPluginVersion` resource to be inlined in the
    /// `WasmPlugin` resource.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct VersionDetails {
        /// Output only. The timestamp when the resource was created.
        pub create_time: std::option::Option<wkt::Timestamp>,

        /// Output only. The timestamp when the resource was updated.
        pub update_time: std::option::Option<wkt::Timestamp>,

        /// Optional. A human-readable description of the resource.
        pub description: std::string::String,

        /// Optional. Set of labels associated with the `WasmPluginVersion`
        /// resource.
        pub labels: std::collections::HashMap<std::string::String, std::string::String>,

        /// Optional. URI of the container image containing the Wasm module, stored
        /// in the Artifact Registry. The container image must contain only a single
        /// file with the name `plugin.wasm`. When a new `WasmPluginVersion` resource
        /// is created, the URI gets resolved to an image digest and saved in the
        /// `image_digest` field.
        pub image_uri: std::string::String,

        /// Output only. The resolved digest for the image specified in `image`.
        /// The digest is resolved during the creation of a
        /// `WasmPluginVersion` resource.
        /// This field holds the digest value regardless of whether a tag or
        /// digest was originally specified in the `image` field.
        pub image_digest: std::string::String,

        /// Output only. This field holds the digest (usually checksum) value for the
        /// plugin configuration. The value is calculated based on the contents of
        /// the `plugin_config_data` field or the container image defined by the
        /// `plugin_config_uri` field.
        pub plugin_config_digest: std::string::String,

        pub plugin_config_source:
            std::option::Option<crate::model::wasm_plugin::version_details::PluginConfigSource>,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl VersionDetails {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [create_time][crate::model::wasm_plugin::VersionDetails::create_time].
        pub fn set_create_time<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<wkt::Timestamp>,
        {
            self.create_time = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [create_time][crate::model::wasm_plugin::VersionDetails::create_time].
        pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<wkt::Timestamp>,
        {
            self.create_time = v.map(|x| x.into());
            self
        }

        /// Sets the value of [update_time][crate::model::wasm_plugin::VersionDetails::update_time].
        pub fn set_update_time<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<wkt::Timestamp>,
        {
            self.update_time = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [update_time][crate::model::wasm_plugin::VersionDetails::update_time].
        pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<wkt::Timestamp>,
        {
            self.update_time = v.map(|x| x.into());
            self
        }

        /// Sets the value of [description][crate::model::wasm_plugin::VersionDetails::description].
        pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
            self.description = v.into();
            self
        }

        /// Sets the value of [labels][crate::model::wasm_plugin::VersionDetails::labels].
        pub fn set_labels<T, K, V>(mut self, v: T) -> Self
        where
            T: std::iter::IntoIterator<Item = (K, V)>,
            K: std::convert::Into<std::string::String>,
            V: std::convert::Into<std::string::String>,
        {
            use std::iter::Iterator;
            self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
            self
        }

        /// Sets the value of [image_uri][crate::model::wasm_plugin::VersionDetails::image_uri].
        pub fn set_image_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
            self.image_uri = v.into();
            self
        }

        /// Sets the value of [image_digest][crate::model::wasm_plugin::VersionDetails::image_digest].
        pub fn set_image_digest<T: std::convert::Into<std::string::String>>(
            mut self,
            v: T,
        ) -> Self {
            self.image_digest = v.into();
            self
        }

        /// Sets the value of [plugin_config_digest][crate::model::wasm_plugin::VersionDetails::plugin_config_digest].
        pub fn set_plugin_config_digest<T: std::convert::Into<std::string::String>>(
            mut self,
            v: T,
        ) -> Self {
            self.plugin_config_digest = v.into();
            self
        }

        /// Sets the value of [plugin_config_source][crate::model::wasm_plugin::VersionDetails::plugin_config_source].
        ///
        /// Note that all the setters affecting `plugin_config_source` are mutually
        /// exclusive.
        pub fn set_plugin_config_source<
            T: std::convert::Into<
                    std::option::Option<
                        crate::model::wasm_plugin::version_details::PluginConfigSource,
                    >,
                >,
        >(
            mut self,
            v: T,
        ) -> Self {
            self.plugin_config_source = v.into();
            self
        }

        /// The value of [plugin_config_source][crate::model::wasm_plugin::VersionDetails::plugin_config_source]
        /// if it holds a `PluginConfigData`, `None` if the field is not set or
        /// holds a different branch.
        pub fn plugin_config_data(&self) -> std::option::Option<&::bytes::Bytes> {
            #[allow(unreachable_patterns)]
            self.plugin_config_source.as_ref().and_then(|v| match v {
                crate::model::wasm_plugin::version_details::PluginConfigSource::PluginConfigData(v) => std::option::Option::Some(v),
                _ => std::option::Option::None,
            })
        }

        /// Sets the value of [plugin_config_source][crate::model::wasm_plugin::VersionDetails::plugin_config_source]
        /// to hold a `PluginConfigData`.
        ///
        /// Note that all the setters affecting `plugin_config_source` are
        /// mutually exclusive.
        pub fn set_plugin_config_data<T: std::convert::Into<::bytes::Bytes>>(
            mut self,
            v: T,
        ) -> Self {
            self.plugin_config_source = std::option::Option::Some(
                crate::model::wasm_plugin::version_details::PluginConfigSource::PluginConfigData(
                    v.into(),
                ),
            );
            self
        }

        /// The value of [plugin_config_source][crate::model::wasm_plugin::VersionDetails::plugin_config_source]
        /// if it holds a `PluginConfigUri`, `None` if the field is not set or
        /// holds a different branch.
        pub fn plugin_config_uri(&self) -> std::option::Option<&std::string::String> {
            #[allow(unreachable_patterns)]
            self.plugin_config_source.as_ref().and_then(|v| match v {
                crate::model::wasm_plugin::version_details::PluginConfigSource::PluginConfigUri(
                    v,
                ) => std::option::Option::Some(v),
                _ => std::option::Option::None,
            })
        }

        /// Sets the value of [plugin_config_source][crate::model::wasm_plugin::VersionDetails::plugin_config_source]
        /// to hold a `PluginConfigUri`.
        ///
        /// Note that all the setters affecting `plugin_config_source` are
        /// mutually exclusive.
        pub fn set_plugin_config_uri<T: std::convert::Into<std::string::String>>(
            mut self,
            v: T,
        ) -> Self {
            self.plugin_config_source = std::option::Option::Some(
                crate::model::wasm_plugin::version_details::PluginConfigSource::PluginConfigUri(
                    v.into(),
                ),
            );
            self
        }
    }

    impl wkt::message::Message for VersionDetails {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.networkservices.v1.WasmPlugin.VersionDetails"
        }
    }

    /// Defines additional types related to [VersionDetails].
    pub mod version_details {
        #[allow(unused_imports)]
        use super::*;

        #[derive(Clone, Debug, PartialEq)]
        #[non_exhaustive]
        pub enum PluginConfigSource {
            /// Configuration for the plugin.
            /// The configuration is provided to the plugin at runtime through
            /// the `ON_CONFIGURE` callback. When a new
            /// `WasmPluginVersion` version is created, the digest of the
            /// contents is saved in the `plugin_config_digest` field.
            PluginConfigData(::bytes::Bytes),
            /// URI of the plugin configuration stored in the Artifact Registry.
            /// The configuration is provided to the plugin at runtime through
            /// the `ON_CONFIGURE` callback. The container image must
            /// contain only a single file with the name
            /// `plugin.config`. When a new `WasmPluginVersion`
            /// resource is created, the digest of the container image is saved in the
            /// `plugin_config_digest` field.
            PluginConfigUri(std::string::String),
        }
    }

    /// Specifies the logging options for the activity performed by this
    /// plugin. If logging is enabled, plugin logs are exported to
    /// Cloud Logging.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct LogConfig {
        /// Optional. Specifies whether to enable logging for activity by this
        /// plugin.
        ///
        /// Defaults to `false`.
        pub enable: bool,

        /// Non-empty default. Configures the sampling rate of activity logs, where
        /// `1.0` means all logged activity is reported and `0.0` means no activity
        /// is reported. A floating point value between `0.0` and `1.0` indicates
        /// that a percentage of log messages is stored.
        ///
        /// The default value when logging is enabled is `1.0`. The value of the
        /// field must be between `0` and `1` (inclusive).
        ///
        /// This field can be specified only if logging is enabled for this plugin.
        pub sample_rate: f32,

        /// Non-empty default. Specifies the lowest level of the plugin logs that
        /// are exported to Cloud Logging. This setting relates to the logs generated
        /// by using logging statements in your Wasm code.
        ///
        /// This field is can be set only if logging is enabled for the plugin.
        ///
        /// If the field is not provided when logging is enabled, it is set to
        /// `INFO` by default.
        pub min_log_level: crate::model::wasm_plugin::log_config::LogLevel,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl LogConfig {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [enable][crate::model::wasm_plugin::LogConfig::enable].
        pub fn set_enable<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
            self.enable = v.into();
            self
        }

        /// Sets the value of [sample_rate][crate::model::wasm_plugin::LogConfig::sample_rate].
        pub fn set_sample_rate<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
            self.sample_rate = v.into();
            self
        }

        /// Sets the value of [min_log_level][crate::model::wasm_plugin::LogConfig::min_log_level].
        pub fn set_min_log_level<
            T: std::convert::Into<crate::model::wasm_plugin::log_config::LogLevel>,
        >(
            mut self,
            v: T,
        ) -> Self {
            self.min_log_level = v.into();
            self
        }
    }

    impl wkt::message::Message for LogConfig {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.networkservices.v1.WasmPlugin.LogConfig"
        }
    }

    /// Defines additional types related to [LogConfig].
    pub mod log_config {
        #[allow(unused_imports)]
        use super::*;

        /// Possible values to specify the lowest level of logs to be exported to
        /// Cloud Logging.
        ///
        /// # Working with unknown values
        ///
        /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
        /// additional enum variants at any time. Adding new variants is not considered
        /// a breaking change. Applications should write their code in anticipation of:
        ///
        /// - New values appearing in future releases of the client library, **and**
        /// - New values received dynamically, without application changes.
        ///
        /// Please consult the [Working with enums] section in the user guide for some
        /// guidelines.
        ///
        /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
        #[derive(Clone, Debug, PartialEq)]
        #[non_exhaustive]
        pub enum LogLevel {
            /// Unspecified value. Defaults to `LogLevel.INFO`.
            Unspecified,
            /// Report logs with TRACE level and above.
            Trace,
            /// Report logs with DEBUG level and above.
            Debug,
            /// Report logs with INFO level and above.
            Info,
            /// Report logs with WARN level and above.
            Warn,
            /// Report logs with ERROR level and above.
            Error,
            /// Report logs with CRITICAL level only.
            Critical,
            /// If set, the enum was initialized with an unknown value.
            ///
            /// Applications can examine the value using [LogLevel::value] or
            /// [LogLevel::name].
            UnknownValue(log_level::UnknownValue),
        }

        #[doc(hidden)]
        pub mod log_level {
            #[allow(unused_imports)]
            use super::*;
            #[derive(Clone, Debug, PartialEq)]
            pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
        }

        impl LogLevel {
            /// Gets the enum value.
            ///
            /// Returns `None` if the enum contains an unknown value deserialized from
            /// the string representation of enums.
            pub fn value(&self) -> std::option::Option<i32> {
                match self {
                    Self::Unspecified => std::option::Option::Some(0),
                    Self::Trace => std::option::Option::Some(1),
                    Self::Debug => std::option::Option::Some(2),
                    Self::Info => std::option::Option::Some(3),
                    Self::Warn => std::option::Option::Some(4),
                    Self::Error => std::option::Option::Some(5),
                    Self::Critical => std::option::Option::Some(6),
                    Self::UnknownValue(u) => u.0.value(),
                }
            }

            /// Gets the enum value as a string.
            ///
            /// Returns `None` if the enum contains an unknown value deserialized from
            /// the integer representation of enums.
            pub fn name(&self) -> std::option::Option<&str> {
                match self {
                    Self::Unspecified => std::option::Option::Some("LOG_LEVEL_UNSPECIFIED"),
                    Self::Trace => std::option::Option::Some("TRACE"),
                    Self::Debug => std::option::Option::Some("DEBUG"),
                    Self::Info => std::option::Option::Some("INFO"),
                    Self::Warn => std::option::Option::Some("WARN"),
                    Self::Error => std::option::Option::Some("ERROR"),
                    Self::Critical => std::option::Option::Some("CRITICAL"),
                    Self::UnknownValue(u) => u.0.name(),
                }
            }
        }

        impl std::default::Default for LogLevel {
            fn default() -> Self {
                use std::convert::From;
                Self::from(0)
            }
        }

        impl std::fmt::Display for LogLevel {
            fn fmt(
                &self,
                f: &mut std::fmt::Formatter<'_>,
            ) -> std::result::Result<(), std::fmt::Error> {
                wkt::internal::display_enum(f, self.name(), self.value())
            }
        }

        impl std::convert::From<i32> for LogLevel {
            fn from(value: i32) -> Self {
                match value {
                    0 => Self::Unspecified,
                    1 => Self::Trace,
                    2 => Self::Debug,
                    3 => Self::Info,
                    4 => Self::Warn,
                    5 => Self::Error,
                    6 => Self::Critical,
                    _ => Self::UnknownValue(log_level::UnknownValue(
                        wkt::internal::UnknownEnumValue::Integer(value),
                    )),
                }
            }
        }

        impl std::convert::From<&str> for LogLevel {
            fn from(value: &str) -> Self {
                use std::string::ToString;
                match value {
                    "LOG_LEVEL_UNSPECIFIED" => Self::Unspecified,
                    "TRACE" => Self::Trace,
                    "DEBUG" => Self::Debug,
                    "INFO" => Self::Info,
                    "WARN" => Self::Warn,
                    "ERROR" => Self::Error,
                    "CRITICAL" => Self::Critical,
                    _ => Self::UnknownValue(log_level::UnknownValue(
                        wkt::internal::UnknownEnumValue::String(value.to_string()),
                    )),
                }
            }
        }

        impl serde::ser::Serialize for LogLevel {
            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
            where
                S: serde::Serializer,
            {
                match self {
                    Self::Unspecified => serializer.serialize_i32(0),
                    Self::Trace => serializer.serialize_i32(1),
                    Self::Debug => serializer.serialize_i32(2),
                    Self::Info => serializer.serialize_i32(3),
                    Self::Warn => serializer.serialize_i32(4),
                    Self::Error => serializer.serialize_i32(5),
                    Self::Critical => serializer.serialize_i32(6),
                    Self::UnknownValue(u) => u.0.serialize(serializer),
                }
            }
        }

        impl<'de> serde::de::Deserialize<'de> for LogLevel {
            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                deserializer.deserialize_any(wkt::internal::EnumVisitor::<LogLevel>::new(
                    ".google.cloud.networkservices.v1.WasmPlugin.LogConfig.LogLevel",
                ))
            }
        }
    }

    /// Defines a resource that uses the `WasmPlugin` resource.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct UsedBy {
        /// Output only. Full name of the resource
        /// <https://google.aip.dev/122#full-resource-names>, for example
        /// `//networkservices.googleapis.com/projects/{project}/locations/{location}/lbRouteExtensions/{extension}`
        pub name: std::string::String,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl UsedBy {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [name][crate::model::wasm_plugin::UsedBy::name].
        pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
            self.name = v.into();
            self
        }
    }

    impl wkt::message::Message for UsedBy {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.networkservices.v1.WasmPlugin.UsedBy"
        }
    }
}

/// A single immutable version of a `WasmPlugin` resource.
/// Defines the Wasm module used and optionally its runtime config.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct WasmPluginVersion {
    /// Identifier. Name of the `WasmPluginVersion` resource in the following
    /// format: `projects/{project}/locations/{location}/wasmPlugins/{wasm_plugin}/
    /// versions/{wasm_plugin_version}`.
    pub name: std::string::String,

    /// Output only. The timestamp when the resource was created.
    pub create_time: std::option::Option<wkt::Timestamp>,

    /// Output only. The timestamp when the resource was updated.
    pub update_time: std::option::Option<wkt::Timestamp>,

    /// Optional. A human-readable description of the resource.
    pub description: std::string::String,

    /// Optional. Set of labels associated with the `WasmPluginVersion`
    /// resource.
    pub labels: std::collections::HashMap<std::string::String, std::string::String>,

    /// Optional. URI of the container image containing the plugin, stored in the
    /// Artifact Registry.
    /// When a new `WasmPluginVersion` resource is created, the digest
    /// of the container image is saved in the `image_digest` field.
    /// When downloading an image, the digest value is used instead of an
    /// image tag.
    pub image_uri: std::string::String,

    /// Output only. The resolved digest for the image specified in the `image`
    /// field. The digest is resolved during the creation of `WasmPluginVersion`
    /// resource. This field holds the digest value, regardless of whether a tag or
    /// digest was originally specified in the `image` field.
    pub image_digest: std::string::String,

    /// Output only. This field holds the digest (usually checksum) value for the
    /// plugin configuration. The value is calculated based on the contents of
    /// `plugin_config_data` or the container image defined by
    /// the `plugin_config_uri` field.
    pub plugin_config_digest: std::string::String,

    pub plugin_config_source:
        std::option::Option<crate::model::wasm_plugin_version::PluginConfigSource>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl WasmPluginVersion {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::WasmPluginVersion::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [create_time][crate::model::WasmPluginVersion::create_time].
    pub fn set_create_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [create_time][crate::model::WasmPluginVersion::create_time].
    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [update_time][crate::model::WasmPluginVersion::update_time].
    pub fn set_update_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_time][crate::model::WasmPluginVersion::update_time].
    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [description][crate::model::WasmPluginVersion::description].
    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.description = v.into();
        self
    }

    /// Sets the value of [labels][crate::model::WasmPluginVersion::labels].
    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<std::string::String>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }

    /// Sets the value of [image_uri][crate::model::WasmPluginVersion::image_uri].
    pub fn set_image_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.image_uri = v.into();
        self
    }

    /// Sets the value of [image_digest][crate::model::WasmPluginVersion::image_digest].
    pub fn set_image_digest<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.image_digest = v.into();
        self
    }

    /// Sets the value of [plugin_config_digest][crate::model::WasmPluginVersion::plugin_config_digest].
    pub fn set_plugin_config_digest<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.plugin_config_digest = v.into();
        self
    }

    /// Sets the value of [plugin_config_source][crate::model::WasmPluginVersion::plugin_config_source].
    ///
    /// Note that all the setters affecting `plugin_config_source` are mutually
    /// exclusive.
    pub fn set_plugin_config_source<
        T: std::convert::Into<
                std::option::Option<crate::model::wasm_plugin_version::PluginConfigSource>,
            >,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.plugin_config_source = v.into();
        self
    }

    /// The value of [plugin_config_source][crate::model::WasmPluginVersion::plugin_config_source]
    /// if it holds a `PluginConfigData`, `None` if the field is not set or
    /// holds a different branch.
    pub fn plugin_config_data(&self) -> std::option::Option<&::bytes::Bytes> {
        #[allow(unreachable_patterns)]
        self.plugin_config_source.as_ref().and_then(|v| match v {
            crate::model::wasm_plugin_version::PluginConfigSource::PluginConfigData(v) => {
                std::option::Option::Some(v)
            }
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [plugin_config_source][crate::model::WasmPluginVersion::plugin_config_source]
    /// to hold a `PluginConfigData`.
    ///
    /// Note that all the setters affecting `plugin_config_source` are
    /// mutually exclusive.
    pub fn set_plugin_config_data<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
        self.plugin_config_source = std::option::Option::Some(
            crate::model::wasm_plugin_version::PluginConfigSource::PluginConfigData(v.into()),
        );
        self
    }

    /// The value of [plugin_config_source][crate::model::WasmPluginVersion::plugin_config_source]
    /// if it holds a `PluginConfigUri`, `None` if the field is not set or
    /// holds a different branch.
    pub fn plugin_config_uri(&self) -> std::option::Option<&std::string::String> {
        #[allow(unreachable_patterns)]
        self.plugin_config_source.as_ref().and_then(|v| match v {
            crate::model::wasm_plugin_version::PluginConfigSource::PluginConfigUri(v) => {
                std::option::Option::Some(v)
            }
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [plugin_config_source][crate::model::WasmPluginVersion::plugin_config_source]
    /// to hold a `PluginConfigUri`.
    ///
    /// Note that all the setters affecting `plugin_config_source` are
    /// mutually exclusive.
    pub fn set_plugin_config_uri<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.plugin_config_source = std::option::Option::Some(
            crate::model::wasm_plugin_version::PluginConfigSource::PluginConfigUri(v.into()),
        );
        self
    }
}

impl wkt::message::Message for WasmPluginVersion {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.WasmPluginVersion"
    }
}

/// Defines additional types related to [WasmPluginVersion].
pub mod wasm_plugin_version {
    #[allow(unused_imports)]
    use super::*;

    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum PluginConfigSource {
        /// Configuration for the plugin.
        /// The configuration is provided to the plugin at runtime through
        /// the `ON_CONFIGURE` callback. When a new
        /// `WasmPluginVersion` resource is created, the digest of the
        /// contents is saved in the `plugin_config_digest` field.
        PluginConfigData(::bytes::Bytes),
        /// URI of the plugin configuration stored in the Artifact Registry.
        /// The configuration is provided to the plugin at runtime through
        /// the `ON_CONFIGURE` callback. The container image must contain
        /// only a single file with the name `plugin.config`. When a
        /// new `WasmPluginVersion` resource is created, the digest of the
        /// container image is saved in the `plugin_config_digest` field.
        PluginConfigUri(std::string::String),
    }
}

/// Request used with the `ListWasmPlugins` method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListWasmPluginsRequest {
    /// Required. The project and location from which the `WasmPlugin` resources
    /// are listed, specified in the following format:
    /// `projects/{project}/locations/global`.
    pub parent: std::string::String,

    /// Maximum number of `WasmPlugin` resources to return per call.
    /// If not specified, at most 50 `WasmPlugin` resources are returned.
    /// The maximum value is 1000; values above 1000 are coerced to 1000.
    pub page_size: i32,

    /// The value returned by the last `ListWasmPluginsResponse` call.
    /// Indicates that this is a continuation of a prior
    /// `ListWasmPlugins` call, and that the
    /// next page of data is to be returned.
    pub page_token: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListWasmPluginsRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::ListWasmPluginsRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [page_size][crate::model::ListWasmPluginsRequest::page_size].
    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.page_size = v.into();
        self
    }

    /// Sets the value of [page_token][crate::model::ListWasmPluginsRequest::page_token].
    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.page_token = v.into();
        self
    }
}

impl wkt::message::Message for ListWasmPluginsRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.ListWasmPluginsRequest"
    }
}

/// Response returned by the `ListWasmPlugins` method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListWasmPluginsResponse {
    /// List of `WasmPlugin` resources.
    pub wasm_plugins: std::vec::Vec<crate::model::WasmPlugin>,

    /// If there might be more results than those appearing in this response, then
    /// `next_page_token` is included. To get the next set of results,
    /// call this method again using the value of `next_page_token` as
    /// `page_token`.
    pub next_page_token: std::string::String,

    /// Unreachable resources. Populated when the request attempts to list all
    /// resources across all supported locations, while some locations are
    /// temporarily unavailable.
    pub unreachable: std::vec::Vec<std::string::String>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListWasmPluginsResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [wasm_plugins][crate::model::ListWasmPluginsResponse::wasm_plugins].
    pub fn set_wasm_plugins<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::WasmPlugin>,
    {
        use std::iter::Iterator;
        self.wasm_plugins = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [next_page_token][crate::model::ListWasmPluginsResponse::next_page_token].
    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.next_page_token = v.into();
        self
    }

    /// Sets the value of [unreachable][crate::model::ListWasmPluginsResponse::unreachable].
    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.unreachable = v.into_iter().map(|i| i.into()).collect();
        self
    }
}

impl wkt::message::Message for ListWasmPluginsResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.ListWasmPluginsResponse"
    }
}

#[doc(hidden)]
impl gax::paginator::internal::PageableResponse for ListWasmPluginsResponse {
    type PageItem = crate::model::WasmPlugin;

    fn items(self) -> std::vec::Vec<Self::PageItem> {
        self.wasm_plugins
    }

    fn next_page_token(&self) -> std::string::String {
        use std::clone::Clone;
        self.next_page_token.clone()
    }
}

/// Request used by the `GetWasmPlugin` method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetWasmPluginRequest {
    /// Required. A name of the `WasmPlugin` resource to get. Must be in the
    /// format `projects/{project}/locations/global/wasmPlugins/{wasm_plugin}`.
    pub name: std::string::String,

    /// Determines how much data must be returned in the response. See
    /// [AIP-157](https://google.aip.dev/157).
    pub view: crate::model::WasmPluginView,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GetWasmPluginRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::GetWasmPluginRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [view][crate::model::GetWasmPluginRequest::view].
    pub fn set_view<T: std::convert::Into<crate::model::WasmPluginView>>(mut self, v: T) -> Self {
        self.view = v.into();
        self
    }
}

impl wkt::message::Message for GetWasmPluginRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.GetWasmPluginRequest"
    }
}

/// Request used by the `CreateWasmPlugin` method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateWasmPluginRequest {
    /// Required. The parent resource of the `WasmPlugin` resource. Must be in the
    /// format `projects/{project}/locations/global`.
    pub parent: std::string::String,

    /// Required. User-provided ID of the `WasmPlugin` resource to be created.
    pub wasm_plugin_id: std::string::String,

    /// Required. `WasmPlugin` resource to be created.
    pub wasm_plugin: std::option::Option<crate::model::WasmPlugin>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl CreateWasmPluginRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::CreateWasmPluginRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [wasm_plugin_id][crate::model::CreateWasmPluginRequest::wasm_plugin_id].
    pub fn set_wasm_plugin_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.wasm_plugin_id = v.into();
        self
    }

    /// Sets the value of [wasm_plugin][crate::model::CreateWasmPluginRequest::wasm_plugin].
    pub fn set_wasm_plugin<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::WasmPlugin>,
    {
        self.wasm_plugin = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [wasm_plugin][crate::model::CreateWasmPluginRequest::wasm_plugin].
    pub fn set_or_clear_wasm_plugin<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::WasmPlugin>,
    {
        self.wasm_plugin = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for CreateWasmPluginRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.CreateWasmPluginRequest"
    }
}

/// Request used by the `UpdateWasmPlugin` method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateWasmPluginRequest {
    /// Optional. Used to specify the fields to be overwritten in the
    /// `WasmPlugin` resource by the update.
    /// The fields specified in the `update_mask` field are relative to the
    /// resource, not the full request.
    /// An omitted `update_mask` field is treated as an implied `update_mask`
    /// field equivalent to all fields that are populated (that have a non-empty
    /// value).
    /// The `update_mask` field supports a special value `*`, which means that
    /// each field in the given `WasmPlugin` resource (including the empty ones)
    /// replaces the current value.
    pub update_mask: std::option::Option<wkt::FieldMask>,

    /// Required. Updated `WasmPlugin` resource.
    pub wasm_plugin: std::option::Option<crate::model::WasmPlugin>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl UpdateWasmPluginRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [update_mask][crate::model::UpdateWasmPluginRequest::update_mask].
    pub fn set_update_mask<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_mask][crate::model::UpdateWasmPluginRequest::update_mask].
    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = v.map(|x| x.into());
        self
    }

    /// Sets the value of [wasm_plugin][crate::model::UpdateWasmPluginRequest::wasm_plugin].
    pub fn set_wasm_plugin<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::WasmPlugin>,
    {
        self.wasm_plugin = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [wasm_plugin][crate::model::UpdateWasmPluginRequest::wasm_plugin].
    pub fn set_or_clear_wasm_plugin<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::WasmPlugin>,
    {
        self.wasm_plugin = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for UpdateWasmPluginRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.UpdateWasmPluginRequest"
    }
}

/// Request used by the `DeleteWasmPlugin` method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteWasmPluginRequest {
    /// Required. A name of the `WasmPlugin` resource to delete. Must be in the
    /// format `projects/{project}/locations/global/wasmPlugins/{wasm_plugin}`.
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl DeleteWasmPluginRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::DeleteWasmPluginRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for DeleteWasmPluginRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.DeleteWasmPluginRequest"
    }
}

/// Request used with the `ListWasmPluginVersions` method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListWasmPluginVersionsRequest {
    /// Required. The `WasmPlugin` resource whose `WasmPluginVersion`s
    /// are listed, specified in the following format:
    /// `projects/{project}/locations/global/wasmPlugins/{wasm_plugin}`.
    pub parent: std::string::String,

    /// Maximum number of `WasmPluginVersion` resources to return per
    /// call. If not specified, at most 50 `WasmPluginVersion` resources are
    /// returned. The maximum value is 1000; values above 1000 are coerced to
    /// 1000.
    pub page_size: i32,

    /// The value returned by the last `ListWasmPluginVersionsResponse` call.
    /// Indicates that this is a continuation of a prior
    /// `ListWasmPluginVersions` call, and that the
    /// next page of data is to be returned.
    pub page_token: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListWasmPluginVersionsRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::ListWasmPluginVersionsRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [page_size][crate::model::ListWasmPluginVersionsRequest::page_size].
    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.page_size = v.into();
        self
    }

    /// Sets the value of [page_token][crate::model::ListWasmPluginVersionsRequest::page_token].
    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.page_token = v.into();
        self
    }
}

impl wkt::message::Message for ListWasmPluginVersionsRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.ListWasmPluginVersionsRequest"
    }
}

/// Response returned by the `ListWasmPluginVersions` method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListWasmPluginVersionsResponse {
    /// List of `WasmPluginVersion` resources.
    pub wasm_plugin_versions: std::vec::Vec<crate::model::WasmPluginVersion>,

    /// If there might be more results than those appearing in this response, then
    /// `next_page_token` is included. To get the next set of results,
    /// call this method again using the value of `next_page_token` as
    /// `page_token`.
    pub next_page_token: std::string::String,

    /// Unreachable resources. Populated when the request attempts to list all
    /// resources across all supported locations, while some locations are
    /// temporarily unavailable.
    pub unreachable: std::vec::Vec<std::string::String>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListWasmPluginVersionsResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [wasm_plugin_versions][crate::model::ListWasmPluginVersionsResponse::wasm_plugin_versions].
    pub fn set_wasm_plugin_versions<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::WasmPluginVersion>,
    {
        use std::iter::Iterator;
        self.wasm_plugin_versions = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [next_page_token][crate::model::ListWasmPluginVersionsResponse::next_page_token].
    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.next_page_token = v.into();
        self
    }

    /// Sets the value of [unreachable][crate::model::ListWasmPluginVersionsResponse::unreachable].
    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.unreachable = v.into_iter().map(|i| i.into()).collect();
        self
    }
}

impl wkt::message::Message for ListWasmPluginVersionsResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.ListWasmPluginVersionsResponse"
    }
}

#[doc(hidden)]
impl gax::paginator::internal::PageableResponse for ListWasmPluginVersionsResponse {
    type PageItem = crate::model::WasmPluginVersion;

    fn items(self) -> std::vec::Vec<Self::PageItem> {
        self.wasm_plugin_versions
    }

    fn next_page_token(&self) -> std::string::String {
        use std::clone::Clone;
        self.next_page_token.clone()
    }
}

/// Request used by the `GetWasmPluginVersion` method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetWasmPluginVersionRequest {
    /// Required. A name of the `WasmPluginVersion` resource to get. Must be in
    /// the format
    /// `projects/{project}/locations/global/wasmPlugins/{wasm_plugin}/versions/{wasm_plugin_version}`.
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GetWasmPluginVersionRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::GetWasmPluginVersionRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for GetWasmPluginVersionRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.GetWasmPluginVersionRequest"
    }
}

/// Request used by the `CreateWasmPluginVersion` method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateWasmPluginVersionRequest {
    /// Required. The parent resource of the `WasmPluginVersion` resource. Must be
    /// in the format
    /// `projects/{project}/locations/global/wasmPlugins/{wasm_plugin}`.
    pub parent: std::string::String,

    /// Required. User-provided ID of the `WasmPluginVersion` resource to be
    /// created.
    pub wasm_plugin_version_id: std::string::String,

    /// Required. `WasmPluginVersion` resource to be created.
    pub wasm_plugin_version: std::option::Option<crate::model::WasmPluginVersion>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl CreateWasmPluginVersionRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::CreateWasmPluginVersionRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [wasm_plugin_version_id][crate::model::CreateWasmPluginVersionRequest::wasm_plugin_version_id].
    pub fn set_wasm_plugin_version_id<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.wasm_plugin_version_id = v.into();
        self
    }

    /// Sets the value of [wasm_plugin_version][crate::model::CreateWasmPluginVersionRequest::wasm_plugin_version].
    pub fn set_wasm_plugin_version<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::WasmPluginVersion>,
    {
        self.wasm_plugin_version = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [wasm_plugin_version][crate::model::CreateWasmPluginVersionRequest::wasm_plugin_version].
    pub fn set_or_clear_wasm_plugin_version<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::WasmPluginVersion>,
    {
        self.wasm_plugin_version = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for CreateWasmPluginVersionRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.CreateWasmPluginVersionRequest"
    }
}

/// Request used by the `DeleteWasmPluginVersion` method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteWasmPluginVersionRequest {
    /// Required. A name of the `WasmPluginVersion` resource to delete. Must be in
    /// the format
    /// `projects/{project}/locations/global/wasmPlugins/{wasm_plugin}/versions/{wasm_plugin_version}`.
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl DeleteWasmPluginVersionRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::DeleteWasmPluginVersionRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for DeleteWasmPluginVersionRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.DeleteWasmPluginVersionRequest"
    }
}

/// Gateway represents the configuration for a proxy, typically a load balancer.
/// It captures the ip:port over which the services are exposed by the proxy,
/// along with any policy configurations. Routes have reference to to Gateways to
/// dictate how requests should be routed by this Gateway.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Gateway {
    /// Identifier. Name of the Gateway resource. It matches pattern
    /// `projects/*/locations/*/gateways/<gateway_name>`.
    pub name: std::string::String,

    /// Output only. Server-defined URL of this resource
    pub self_link: std::string::String,

    /// Output only. The timestamp when the resource was created.
    pub create_time: std::option::Option<wkt::Timestamp>,

    /// Output only. The timestamp when the resource was updated.
    pub update_time: std::option::Option<wkt::Timestamp>,

    /// Optional. Set of label tags associated with the Gateway resource.
    pub labels: std::collections::HashMap<std::string::String, std::string::String>,

    /// Optional. A free-text description of the resource. Max length 1024
    /// characters.
    pub description: std::string::String,

    /// Immutable. The type of the customer managed gateway.
    /// This field is required. If unspecified, an error is returned.
    pub r#type: crate::model::gateway::Type,

    /// Optional. Zero or one IPv4 or IPv6 address on which the Gateway will
    /// receive the traffic. When no address is provided, an IP from the subnetwork
    /// is allocated
    ///
    /// This field only applies to gateways of type 'SECURE_WEB_GATEWAY'.
    /// Gateways of type 'OPEN_MESH' listen on 0.0.0.0 for IPv4 and :: for IPv6.
    pub addresses: std::vec::Vec<std::string::String>,

    /// Required. One or more port numbers (1-65535), on which the Gateway will
    /// receive traffic. The proxy binds to the specified ports.
    /// Gateways of type 'SECURE_WEB_GATEWAY' are limited to 1 port.
    /// Gateways of type 'OPEN_MESH' listen on 0.0.0.0 for IPv4 and :: for IPv6 and
    /// support multiple ports.
    pub ports: std::vec::Vec<i32>,

    /// Optional. Scope determines how configuration across multiple Gateway
    /// instances are merged. The configuration for multiple Gateway instances with
    /// the same scope will be merged as presented as a single configuration to the
    /// proxy/load balancer.
    ///
    /// Max length 64 characters.
    /// Scope should start with a letter and can only have letters, numbers,
    /// hyphens.
    pub scope: std::string::String,

    /// Optional. A fully-qualified ServerTLSPolicy URL reference. Specifies how
    /// TLS traffic is terminated. If empty, TLS termination is disabled.
    pub server_tls_policy: std::string::String,

    /// Optional. A fully-qualified Certificates URL reference. The proxy presents
    /// a Certificate (selected based on SNI) when establishing a TLS connection.
    /// This feature only applies to gateways of type 'SECURE_WEB_GATEWAY'.
    pub certificate_urls: std::vec::Vec<std::string::String>,

    /// Optional. A fully-qualified GatewaySecurityPolicy URL reference.
    /// Defines how a server should apply security policy to inbound
    /// (VM to Proxy) initiated connections.
    ///
    /// For example:
    /// `projects/*/locations/*/gatewaySecurityPolicies/swg-policy`.
    ///
    /// This policy is specific to gateways of type 'SECURE_WEB_GATEWAY'.
    pub gateway_security_policy: std::string::String,

    /// Optional. The relative resource name identifying the VPC network that is
    /// using this configuration. For example:
    /// `projects/*/global/networks/network-1`.
    ///
    /// Currently, this field is specific to gateways of type 'SECURE_WEB_GATEWAY'.
    pub network: std::string::String,

    /// Optional. The relative resource name identifying  the subnetwork in which
    /// this SWG is allocated. For example:
    /// `projects/*/regions/us-central1/subnetworks/network-1`
    ///
    /// Currently, this field is specific to gateways of type 'SECURE_WEB_GATEWAY".
    pub subnetwork: std::string::String,

    /// Optional. The IP Version that will be used by this gateway. Valid options
    /// are IPV4 or IPV6. Default is IPV4.
    pub ip_version: crate::model::gateway::IpVersion,

    /// Optional. Determines if envoy will insert internal debug headers into
    /// upstream requests. Other Envoy headers may still be injected. By default,
    /// envoy will not insert any debug headers.
    pub envoy_headers: std::option::Option<crate::model::EnvoyHeaders>,

    /// Optional. The routing mode of the Gateway.
    /// This field is configurable only for gateways of type SECURE_WEB_GATEWAY.
    /// This field is required for gateways of type SECURE_WEB_GATEWAY.
    pub routing_mode: crate::model::gateway::RoutingMode,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl Gateway {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::Gateway::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [self_link][crate::model::Gateway::self_link].
    pub fn set_self_link<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.self_link = v.into();
        self
    }

    /// Sets the value of [create_time][crate::model::Gateway::create_time].
    pub fn set_create_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [create_time][crate::model::Gateway::create_time].
    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [update_time][crate::model::Gateway::update_time].
    pub fn set_update_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_time][crate::model::Gateway::update_time].
    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [labels][crate::model::Gateway::labels].
    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<std::string::String>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }

    /// Sets the value of [description][crate::model::Gateway::description].
    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.description = v.into();
        self
    }

    /// Sets the value of [r#type][crate::model::Gateway::type].
    pub fn set_type<T: std::convert::Into<crate::model::gateway::Type>>(mut self, v: T) -> Self {
        self.r#type = v.into();
        self
    }

    /// Sets the value of [addresses][crate::model::Gateway::addresses].
    pub fn set_addresses<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.addresses = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [ports][crate::model::Gateway::ports].
    pub fn set_ports<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<i32>,
    {
        use std::iter::Iterator;
        self.ports = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [scope][crate::model::Gateway::scope].
    pub fn set_scope<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.scope = v.into();
        self
    }

    /// Sets the value of [server_tls_policy][crate::model::Gateway::server_tls_policy].
    pub fn set_server_tls_policy<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.server_tls_policy = v.into();
        self
    }

    /// Sets the value of [certificate_urls][crate::model::Gateway::certificate_urls].
    pub fn set_certificate_urls<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.certificate_urls = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [gateway_security_policy][crate::model::Gateway::gateway_security_policy].
    pub fn set_gateway_security_policy<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.gateway_security_policy = v.into();
        self
    }

    /// Sets the value of [network][crate::model::Gateway::network].
    pub fn set_network<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.network = v.into();
        self
    }

    /// Sets the value of [subnetwork][crate::model::Gateway::subnetwork].
    pub fn set_subnetwork<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.subnetwork = v.into();
        self
    }

    /// Sets the value of [ip_version][crate::model::Gateway::ip_version].
    pub fn set_ip_version<T: std::convert::Into<crate::model::gateway::IpVersion>>(
        mut self,
        v: T,
    ) -> Self {
        self.ip_version = v.into();
        self
    }

    /// Sets the value of [envoy_headers][crate::model::Gateway::envoy_headers].
    pub fn set_envoy_headers<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::EnvoyHeaders>,
    {
        self.envoy_headers = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [envoy_headers][crate::model::Gateway::envoy_headers].
    pub fn set_or_clear_envoy_headers<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::EnvoyHeaders>,
    {
        self.envoy_headers = v.map(|x| x.into());
        self
    }

    /// Sets the value of [routing_mode][crate::model::Gateway::routing_mode].
    pub fn set_routing_mode<T: std::convert::Into<crate::model::gateway::RoutingMode>>(
        mut self,
        v: T,
    ) -> Self {
        self.routing_mode = v.into();
        self
    }
}

impl wkt::message::Message for Gateway {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.Gateway"
    }
}

/// Defines additional types related to [Gateway].
pub mod gateway {
    #[allow(unused_imports)]
    use super::*;

    /// The type of the customer-managed gateway.
    /// Possible values are:
    ///
    /// * OPEN_MESH
    /// * SECURE_WEB_GATEWAY
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum Type {
        /// The type of the customer managed gateway is unspecified.
        Unspecified,
        /// The type of the customer managed gateway is TrafficDirector Open
        /// Mesh.
        OpenMesh,
        /// The type of the customer managed gateway is SecureWebGateway (SWG).
        SecureWebGateway,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [Type::value] or
        /// [Type::name].
        UnknownValue(r#type::UnknownValue),
    }

    #[doc(hidden)]
    pub mod r#type {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl Type {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::OpenMesh => std::option::Option::Some(1),
                Self::SecureWebGateway => std::option::Option::Some(2),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
                Self::OpenMesh => std::option::Option::Some("OPEN_MESH"),
                Self::SecureWebGateway => std::option::Option::Some("SECURE_WEB_GATEWAY"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for Type {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for Type {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for Type {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                1 => Self::OpenMesh,
                2 => Self::SecureWebGateway,
                _ => Self::UnknownValue(r#type::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for Type {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "TYPE_UNSPECIFIED" => Self::Unspecified,
                "OPEN_MESH" => Self::OpenMesh,
                "SECURE_WEB_GATEWAY" => Self::SecureWebGateway,
                _ => Self::UnknownValue(r#type::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for Type {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::OpenMesh => serializer.serialize_i32(1),
                Self::SecureWebGateway => serializer.serialize_i32(2),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for Type {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
                ".google.cloud.networkservices.v1.Gateway.Type",
            ))
        }
    }

    /// The types of IP version for the gateway.
    /// Possible values are:
    ///
    /// * IPV4
    /// * IPV6
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum IpVersion {
        /// The type when IP version is not specified. Defaults to IPV4.
        Unspecified,
        /// The type for IP version 4.
        Ipv4,
        /// The type for IP version 6.
        Ipv6,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [IpVersion::value] or
        /// [IpVersion::name].
        UnknownValue(ip_version::UnknownValue),
    }

    #[doc(hidden)]
    pub mod ip_version {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl IpVersion {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::Ipv4 => std::option::Option::Some(1),
                Self::Ipv6 => std::option::Option::Some(2),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => std::option::Option::Some("IP_VERSION_UNSPECIFIED"),
                Self::Ipv4 => std::option::Option::Some("IPV4"),
                Self::Ipv6 => std::option::Option::Some("IPV6"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for IpVersion {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for IpVersion {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for IpVersion {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                1 => Self::Ipv4,
                2 => Self::Ipv6,
                _ => Self::UnknownValue(ip_version::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for IpVersion {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "IP_VERSION_UNSPECIFIED" => Self::Unspecified,
                "IPV4" => Self::Ipv4,
                "IPV6" => Self::Ipv6,
                _ => Self::UnknownValue(ip_version::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for IpVersion {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::Ipv4 => serializer.serialize_i32(1),
                Self::Ipv6 => serializer.serialize_i32(2),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for IpVersion {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<IpVersion>::new(
                ".google.cloud.networkservices.v1.Gateway.IpVersion",
            ))
        }
    }

    /// The routing mode of the Gateway, to determine how the Gateway routes
    /// traffic. Today, this field only applies to Gateways of type
    /// SECURE_WEB_GATEWAY. Possible values are:
    ///
    /// * EXPLICIT_ROUTING_MODE
    /// * NEXT_HOP_ROUTING_MODE
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum RoutingMode {
        /// The routing mode is explicit; clients are configured to send
        /// traffic through the gateway. This is the default routing mode.
        ExplicitRoutingMode,
        /// The routing mode is next-hop. Clients are unaware of the gateway,
        /// and a route (advanced route or other route type)
        /// can be configured to direct traffic from client to gateway.
        /// The gateway then acts as a next-hop to the destination.
        NextHopRoutingMode,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [RoutingMode::value] or
        /// [RoutingMode::name].
        UnknownValue(routing_mode::UnknownValue),
    }

    #[doc(hidden)]
    pub mod routing_mode {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl RoutingMode {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::ExplicitRoutingMode => std::option::Option::Some(0),
                Self::NextHopRoutingMode => std::option::Option::Some(1),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::ExplicitRoutingMode => std::option::Option::Some("EXPLICIT_ROUTING_MODE"),
                Self::NextHopRoutingMode => std::option::Option::Some("NEXT_HOP_ROUTING_MODE"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for RoutingMode {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for RoutingMode {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for RoutingMode {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::ExplicitRoutingMode,
                1 => Self::NextHopRoutingMode,
                _ => Self::UnknownValue(routing_mode::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for RoutingMode {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "EXPLICIT_ROUTING_MODE" => Self::ExplicitRoutingMode,
                "NEXT_HOP_ROUTING_MODE" => Self::NextHopRoutingMode,
                _ => Self::UnknownValue(routing_mode::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for RoutingMode {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::ExplicitRoutingMode => serializer.serialize_i32(0),
                Self::NextHopRoutingMode => serializer.serialize_i32(1),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for RoutingMode {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<RoutingMode>::new(
                ".google.cloud.networkservices.v1.Gateway.RoutingMode",
            ))
        }
    }
}

/// Request used with the ListGateways method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListGatewaysRequest {
    /// Required. The project and location from which the Gateways should be
    /// listed, specified in the format `projects/*/locations/*`.
    pub parent: std::string::String,

    /// Maximum number of Gateways to return per call.
    pub page_size: i32,

    /// The value returned by the last `ListGatewaysResponse`
    /// Indicates that this is a continuation of a prior `ListGateways` call,
    /// and that the system should return the next page of data.
    pub page_token: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListGatewaysRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::ListGatewaysRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [page_size][crate::model::ListGatewaysRequest::page_size].
    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.page_size = v.into();
        self
    }

    /// Sets the value of [page_token][crate::model::ListGatewaysRequest::page_token].
    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.page_token = v.into();
        self
    }
}

impl wkt::message::Message for ListGatewaysRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.ListGatewaysRequest"
    }
}

/// Response returned by the ListGateways method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListGatewaysResponse {
    /// List of Gateway resources.
    pub gateways: std::vec::Vec<crate::model::Gateway>,

    /// If there might be more results than those appearing in this response, then
    /// `next_page_token` is included. To get the next set of results, call this
    /// method again using the value of `next_page_token` as `page_token`.
    pub next_page_token: std::string::String,

    /// Locations that could not be reached.
    pub unreachable: std::vec::Vec<std::string::String>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListGatewaysResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [gateways][crate::model::ListGatewaysResponse::gateways].
    pub fn set_gateways<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::Gateway>,
    {
        use std::iter::Iterator;
        self.gateways = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [next_page_token][crate::model::ListGatewaysResponse::next_page_token].
    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.next_page_token = v.into();
        self
    }

    /// Sets the value of [unreachable][crate::model::ListGatewaysResponse::unreachable].
    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.unreachable = v.into_iter().map(|i| i.into()).collect();
        self
    }
}

impl wkt::message::Message for ListGatewaysResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.ListGatewaysResponse"
    }
}

#[doc(hidden)]
impl gax::paginator::internal::PageableResponse for ListGatewaysResponse {
    type PageItem = crate::model::Gateway;

    fn items(self) -> std::vec::Vec<Self::PageItem> {
        self.gateways
    }

    fn next_page_token(&self) -> std::string::String {
        use std::clone::Clone;
        self.next_page_token.clone()
    }
}

/// Request used by the GetGateway method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetGatewayRequest {
    /// Required. A name of the Gateway to get. Must be in the format
    /// `projects/*/locations/*/gateways/*`.
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GetGatewayRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::GetGatewayRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for GetGatewayRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.GetGatewayRequest"
    }
}

/// Request used by the CreateGateway method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateGatewayRequest {
    /// Required. The parent resource of the Gateway. Must be in the
    /// format `projects/*/locations/*`.
    pub parent: std::string::String,

    /// Required. Short name of the Gateway resource to be created.
    pub gateway_id: std::string::String,

    /// Required. Gateway resource to be created.
    pub gateway: std::option::Option<crate::model::Gateway>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl CreateGatewayRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::CreateGatewayRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [gateway_id][crate::model::CreateGatewayRequest::gateway_id].
    pub fn set_gateway_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.gateway_id = v.into();
        self
    }

    /// Sets the value of [gateway][crate::model::CreateGatewayRequest::gateway].
    pub fn set_gateway<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::Gateway>,
    {
        self.gateway = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [gateway][crate::model::CreateGatewayRequest::gateway].
    pub fn set_or_clear_gateway<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::Gateway>,
    {
        self.gateway = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for CreateGatewayRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.CreateGatewayRequest"
    }
}

/// Request used by the UpdateGateway method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateGatewayRequest {
    /// Optional. Field mask is used to specify the fields to be overwritten in the
    /// Gateway resource by the update.
    /// The fields specified in the update_mask are relative to the resource, not
    /// the full request. A field will be overwritten if it is in the mask. If the
    /// user does not provide a mask then all fields will be overwritten.
    pub update_mask: std::option::Option<wkt::FieldMask>,

    /// Required. Updated Gateway resource.
    pub gateway: std::option::Option<crate::model::Gateway>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl UpdateGatewayRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [update_mask][crate::model::UpdateGatewayRequest::update_mask].
    pub fn set_update_mask<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_mask][crate::model::UpdateGatewayRequest::update_mask].
    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = v.map(|x| x.into());
        self
    }

    /// Sets the value of [gateway][crate::model::UpdateGatewayRequest::gateway].
    pub fn set_gateway<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::Gateway>,
    {
        self.gateway = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [gateway][crate::model::UpdateGatewayRequest::gateway].
    pub fn set_or_clear_gateway<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::Gateway>,
    {
        self.gateway = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for UpdateGatewayRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.UpdateGatewayRequest"
    }
}

/// Request used by the DeleteGateway method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteGatewayRequest {
    /// Required. A name of the Gateway to delete. Must be in the format
    /// `projects/*/locations/*/gateways/*`.
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl DeleteGatewayRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::DeleteGatewayRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for DeleteGatewayRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.DeleteGatewayRequest"
    }
}

/// GrpcRoute is the resource defining how gRPC traffic routed by a Mesh
/// or Gateway resource is routed.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GrpcRoute {
    /// Identifier. Name of the GrpcRoute resource. It matches pattern
    /// `projects/*/locations/global/grpcRoutes/<grpc_route_name>`
    pub name: std::string::String,

    /// Output only. Server-defined URL of this resource
    pub self_link: std::string::String,

    /// Output only. The timestamp when the resource was created.
    pub create_time: std::option::Option<wkt::Timestamp>,

    /// Output only. The timestamp when the resource was updated.
    pub update_time: std::option::Option<wkt::Timestamp>,

    /// Optional. Set of label tags associated with the GrpcRoute resource.
    pub labels: std::collections::HashMap<std::string::String, std::string::String>,

    /// Optional. A free-text description of the resource. Max length 1024
    /// characters.
    pub description: std::string::String,

    /// Required. Service hostnames with an optional port for which this route
    /// describes traffic.
    ///
    /// Format: \<hostname\>[:\<port\>]
    ///
    /// Hostname is the fully qualified domain name of a network host. This matches
    /// the RFC 1123 definition of a hostname with 2 notable exceptions:
    ///
    /// - IPs are not allowed.
    /// - A hostname may be prefixed with a wildcard label (`*.`). The wildcard
    ///   label must appear by itself as the first label.
    ///
    /// Hostname can be "precise" which is a domain name without the terminating
    /// dot of a network host (e.g. `foo.example.com`) or "wildcard", which is a
    /// domain name prefixed with a single wildcard label (e.g. `*.example.com`).
    ///
    /// Note that as per RFC1035 and RFC1123, a label must consist of lower case
    /// alphanumeric characters or '-', and must start and end with an alphanumeric
    /// character. No other punctuation is allowed.
    ///
    /// The routes associated with a Mesh or Gateway must have unique hostnames. If
    /// you attempt to attach multiple routes with conflicting hostnames, the
    /// configuration will be rejected.
    ///
    /// For example, while it is acceptable for routes for the hostnames
    /// `*.foo.bar.com` and `*.bar.com` to be associated with the same route, it is
    /// not possible to associate two routes both with `*.bar.com` or both with
    /// `bar.com`.
    ///
    /// If a port is specified, then gRPC clients must use the channel URI with the
    /// port to match this rule (i.e. "xds:///service:123"), otherwise they must
    /// supply the URI without a port (i.e. "xds:///service").
    pub hostnames: std::vec::Vec<std::string::String>,

    /// Optional. Meshes defines a list of meshes this GrpcRoute is attached to, as
    /// one of the routing rules to route the requests served by the mesh.
    ///
    /// Each mesh reference should match the pattern:
    /// `projects/*/locations/global/meshes/<mesh_name>`
    pub meshes: std::vec::Vec<std::string::String>,

    /// Optional. Gateways defines a list of gateways this GrpcRoute is attached
    /// to, as one of the routing rules to route the requests served by the
    /// gateway.
    ///
    /// Each gateway reference should match the pattern:
    /// `projects/*/locations/global/gateways/<gateway_name>`
    pub gateways: std::vec::Vec<std::string::String>,

    /// Required. A list of detailed rules defining how to route traffic.
    ///
    /// Within a single GrpcRoute, the GrpcRoute.RouteAction associated with the
    /// first matching GrpcRoute.RouteRule will be executed. At least one rule
    /// must be supplied.
    pub rules: std::vec::Vec<crate::model::grpc_route::RouteRule>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GrpcRoute {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::GrpcRoute::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [self_link][crate::model::GrpcRoute::self_link].
    pub fn set_self_link<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.self_link = v.into();
        self
    }

    /// Sets the value of [create_time][crate::model::GrpcRoute::create_time].
    pub fn set_create_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [create_time][crate::model::GrpcRoute::create_time].
    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [update_time][crate::model::GrpcRoute::update_time].
    pub fn set_update_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_time][crate::model::GrpcRoute::update_time].
    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [labels][crate::model::GrpcRoute::labels].
    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<std::string::String>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }

    /// Sets the value of [description][crate::model::GrpcRoute::description].
    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.description = v.into();
        self
    }

    /// Sets the value of [hostnames][crate::model::GrpcRoute::hostnames].
    pub fn set_hostnames<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.hostnames = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [meshes][crate::model::GrpcRoute::meshes].
    pub fn set_meshes<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.meshes = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [gateways][crate::model::GrpcRoute::gateways].
    pub fn set_gateways<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.gateways = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [rules][crate::model::GrpcRoute::rules].
    pub fn set_rules<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::grpc_route::RouteRule>,
    {
        use std::iter::Iterator;
        self.rules = v.into_iter().map(|i| i.into()).collect();
        self
    }
}

impl wkt::message::Message for GrpcRoute {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.GrpcRoute"
    }
}

/// Defines additional types related to [GrpcRoute].
pub mod grpc_route {
    #[allow(unused_imports)]
    use super::*;

    /// Specifies a match against a method.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct MethodMatch {
        /// Optional. Specifies how to match against the name. If not specified, a
        /// default value of "EXACT" is used.
        pub r#type: crate::model::grpc_route::method_match::Type,

        /// Required. Name of the service to match against. If unspecified, will
        /// match all services.
        pub grpc_service: std::string::String,

        /// Required. Name of the method to match against. If unspecified, will match
        /// all methods.
        pub grpc_method: std::string::String,

        /// Optional. Specifies that matches are case sensitive.  The default value
        /// is true. case_sensitive must not be used with a type of
        /// REGULAR_EXPRESSION.
        pub case_sensitive: std::option::Option<bool>,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl MethodMatch {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [r#type][crate::model::grpc_route::MethodMatch::type].
        pub fn set_type<T: std::convert::Into<crate::model::grpc_route::method_match::Type>>(
            mut self,
            v: T,
        ) -> Self {
            self.r#type = v.into();
            self
        }

        /// Sets the value of [grpc_service][crate::model::grpc_route::MethodMatch::grpc_service].
        pub fn set_grpc_service<T: std::convert::Into<std::string::String>>(
            mut self,
            v: T,
        ) -> Self {
            self.grpc_service = v.into();
            self
        }

        /// Sets the value of [grpc_method][crate::model::grpc_route::MethodMatch::grpc_method].
        pub fn set_grpc_method<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
            self.grpc_method = v.into();
            self
        }

        /// Sets the value of [case_sensitive][crate::model::grpc_route::MethodMatch::case_sensitive].
        pub fn set_case_sensitive<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<bool>,
        {
            self.case_sensitive = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [case_sensitive][crate::model::grpc_route::MethodMatch::case_sensitive].
        pub fn set_or_clear_case_sensitive<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<bool>,
        {
            self.case_sensitive = v.map(|x| x.into());
            self
        }
    }

    impl wkt::message::Message for MethodMatch {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.networkservices.v1.GrpcRoute.MethodMatch"
        }
    }

    /// Defines additional types related to [MethodMatch].
    pub mod method_match {
        #[allow(unused_imports)]
        use super::*;

        /// The type of the match.
        ///
        /// # Working with unknown values
        ///
        /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
        /// additional enum variants at any time. Adding new variants is not considered
        /// a breaking change. Applications should write their code in anticipation of:
        ///
        /// - New values appearing in future releases of the client library, **and**
        /// - New values received dynamically, without application changes.
        ///
        /// Please consult the [Working with enums] section in the user guide for some
        /// guidelines.
        ///
        /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
        #[derive(Clone, Debug, PartialEq)]
        #[non_exhaustive]
        pub enum Type {
            /// Unspecified.
            Unspecified,
            /// Will only match the exact name provided.
            Exact,
            /// Will interpret grpc_method and grpc_service as regexes. RE2 syntax is
            /// supported.
            RegularExpression,
            /// If set, the enum was initialized with an unknown value.
            ///
            /// Applications can examine the value using [Type::value] or
            /// [Type::name].
            UnknownValue(r#type::UnknownValue),
        }

        #[doc(hidden)]
        pub mod r#type {
            #[allow(unused_imports)]
            use super::*;
            #[derive(Clone, Debug, PartialEq)]
            pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
        }

        impl Type {
            /// Gets the enum value.
            ///
            /// Returns `None` if the enum contains an unknown value deserialized from
            /// the string representation of enums.
            pub fn value(&self) -> std::option::Option<i32> {
                match self {
                    Self::Unspecified => std::option::Option::Some(0),
                    Self::Exact => std::option::Option::Some(1),
                    Self::RegularExpression => std::option::Option::Some(2),
                    Self::UnknownValue(u) => u.0.value(),
                }
            }

            /// Gets the enum value as a string.
            ///
            /// Returns `None` if the enum contains an unknown value deserialized from
            /// the integer representation of enums.
            pub fn name(&self) -> std::option::Option<&str> {
                match self {
                    Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
                    Self::Exact => std::option::Option::Some("EXACT"),
                    Self::RegularExpression => std::option::Option::Some("REGULAR_EXPRESSION"),
                    Self::UnknownValue(u) => u.0.name(),
                }
            }
        }

        impl std::default::Default for Type {
            fn default() -> Self {
                use std::convert::From;
                Self::from(0)
            }
        }

        impl std::fmt::Display for Type {
            fn fmt(
                &self,
                f: &mut std::fmt::Formatter<'_>,
            ) -> std::result::Result<(), std::fmt::Error> {
                wkt::internal::display_enum(f, self.name(), self.value())
            }
        }

        impl std::convert::From<i32> for Type {
            fn from(value: i32) -> Self {
                match value {
                    0 => Self::Unspecified,
                    1 => Self::Exact,
                    2 => Self::RegularExpression,
                    _ => Self::UnknownValue(r#type::UnknownValue(
                        wkt::internal::UnknownEnumValue::Integer(value),
                    )),
                }
            }
        }

        impl std::convert::From<&str> for Type {
            fn from(value: &str) -> Self {
                use std::string::ToString;
                match value {
                    "TYPE_UNSPECIFIED" => Self::Unspecified,
                    "EXACT" => Self::Exact,
                    "REGULAR_EXPRESSION" => Self::RegularExpression,
                    _ => Self::UnknownValue(r#type::UnknownValue(
                        wkt::internal::UnknownEnumValue::String(value.to_string()),
                    )),
                }
            }
        }

        impl serde::ser::Serialize for Type {
            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
            where
                S: serde::Serializer,
            {
                match self {
                    Self::Unspecified => serializer.serialize_i32(0),
                    Self::Exact => serializer.serialize_i32(1),
                    Self::RegularExpression => serializer.serialize_i32(2),
                    Self::UnknownValue(u) => u.0.serialize(serializer),
                }
            }
        }

        impl<'de> serde::de::Deserialize<'de> for Type {
            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
                    ".google.cloud.networkservices.v1.GrpcRoute.MethodMatch.Type",
                ))
            }
        }
    }

    /// A match against a collection of headers.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct HeaderMatch {
        /// Optional. Specifies how to match against the value of the header. If not
        /// specified, a default value of EXACT is used.
        pub r#type: crate::model::grpc_route::header_match::Type,

        /// Required. The key of the header.
        pub key: std::string::String,

        /// Required. The value of the header.
        pub value: std::string::String,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl HeaderMatch {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [r#type][crate::model::grpc_route::HeaderMatch::type].
        pub fn set_type<T: std::convert::Into<crate::model::grpc_route::header_match::Type>>(
            mut self,
            v: T,
        ) -> Self {
            self.r#type = v.into();
            self
        }

        /// Sets the value of [key][crate::model::grpc_route::HeaderMatch::key].
        pub fn set_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
            self.key = v.into();
            self
        }

        /// Sets the value of [value][crate::model::grpc_route::HeaderMatch::value].
        pub fn set_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
            self.value = v.into();
            self
        }
    }

    impl wkt::message::Message for HeaderMatch {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.networkservices.v1.GrpcRoute.HeaderMatch"
        }
    }

    /// Defines additional types related to [HeaderMatch].
    pub mod header_match {
        #[allow(unused_imports)]
        use super::*;

        /// The type of match.
        ///
        /// # Working with unknown values
        ///
        /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
        /// additional enum variants at any time. Adding new variants is not considered
        /// a breaking change. Applications should write their code in anticipation of:
        ///
        /// - New values appearing in future releases of the client library, **and**
        /// - New values received dynamically, without application changes.
        ///
        /// Please consult the [Working with enums] section in the user guide for some
        /// guidelines.
        ///
        /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
        #[derive(Clone, Debug, PartialEq)]
        #[non_exhaustive]
        pub enum Type {
            /// Unspecified.
            Unspecified,
            /// Will only match the exact value provided.
            Exact,
            /// Will match paths conforming to the prefix specified by value. RE2
            /// syntax is supported.
            RegularExpression,
            /// If set, the enum was initialized with an unknown value.
            ///
            /// Applications can examine the value using [Type::value] or
            /// [Type::name].
            UnknownValue(r#type::UnknownValue),
        }

        #[doc(hidden)]
        pub mod r#type {
            #[allow(unused_imports)]
            use super::*;
            #[derive(Clone, Debug, PartialEq)]
            pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
        }

        impl Type {
            /// Gets the enum value.
            ///
            /// Returns `None` if the enum contains an unknown value deserialized from
            /// the string representation of enums.
            pub fn value(&self) -> std::option::Option<i32> {
                match self {
                    Self::Unspecified => std::option::Option::Some(0),
                    Self::Exact => std::option::Option::Some(1),
                    Self::RegularExpression => std::option::Option::Some(2),
                    Self::UnknownValue(u) => u.0.value(),
                }
            }

            /// Gets the enum value as a string.
            ///
            /// Returns `None` if the enum contains an unknown value deserialized from
            /// the integer representation of enums.
            pub fn name(&self) -> std::option::Option<&str> {
                match self {
                    Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
                    Self::Exact => std::option::Option::Some("EXACT"),
                    Self::RegularExpression => std::option::Option::Some("REGULAR_EXPRESSION"),
                    Self::UnknownValue(u) => u.0.name(),
                }
            }
        }

        impl std::default::Default for Type {
            fn default() -> Self {
                use std::convert::From;
                Self::from(0)
            }
        }

        impl std::fmt::Display for Type {
            fn fmt(
                &self,
                f: &mut std::fmt::Formatter<'_>,
            ) -> std::result::Result<(), std::fmt::Error> {
                wkt::internal::display_enum(f, self.name(), self.value())
            }
        }

        impl std::convert::From<i32> for Type {
            fn from(value: i32) -> Self {
                match value {
                    0 => Self::Unspecified,
                    1 => Self::Exact,
                    2 => Self::RegularExpression,
                    _ => Self::UnknownValue(r#type::UnknownValue(
                        wkt::internal::UnknownEnumValue::Integer(value),
                    )),
                }
            }
        }

        impl std::convert::From<&str> for Type {
            fn from(value: &str) -> Self {
                use std::string::ToString;
                match value {
                    "TYPE_UNSPECIFIED" => Self::Unspecified,
                    "EXACT" => Self::Exact,
                    "REGULAR_EXPRESSION" => Self::RegularExpression,
                    _ => Self::UnknownValue(r#type::UnknownValue(
                        wkt::internal::UnknownEnumValue::String(value.to_string()),
                    )),
                }
            }
        }

        impl serde::ser::Serialize for Type {
            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
            where
                S: serde::Serializer,
            {
                match self {
                    Self::Unspecified => serializer.serialize_i32(0),
                    Self::Exact => serializer.serialize_i32(1),
                    Self::RegularExpression => serializer.serialize_i32(2),
                    Self::UnknownValue(u) => u.0.serialize(serializer),
                }
            }
        }

        impl<'de> serde::de::Deserialize<'de> for Type {
            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
                    ".google.cloud.networkservices.v1.GrpcRoute.HeaderMatch.Type",
                ))
            }
        }
    }

    /// Criteria for matching traffic. A RouteMatch will be considered to match
    /// when all supplied fields match.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct RouteMatch {
        /// Optional. A gRPC method to match against. If this field is empty or
        /// omitted, will match all methods.
        pub method: std::option::Option<crate::model::grpc_route::MethodMatch>,

        /// Optional. Specifies a collection of headers to match.
        pub headers: std::vec::Vec<crate::model::grpc_route::HeaderMatch>,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl RouteMatch {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [method][crate::model::grpc_route::RouteMatch::method].
        pub fn set_method<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<crate::model::grpc_route::MethodMatch>,
        {
            self.method = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [method][crate::model::grpc_route::RouteMatch::method].
        pub fn set_or_clear_method<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<crate::model::grpc_route::MethodMatch>,
        {
            self.method = v.map(|x| x.into());
            self
        }

        /// Sets the value of [headers][crate::model::grpc_route::RouteMatch::headers].
        pub fn set_headers<T, V>(mut self, v: T) -> Self
        where
            T: std::iter::IntoIterator<Item = V>,
            V: std::convert::Into<crate::model::grpc_route::HeaderMatch>,
        {
            use std::iter::Iterator;
            self.headers = v.into_iter().map(|i| i.into()).collect();
            self
        }
    }

    impl wkt::message::Message for RouteMatch {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.networkservices.v1.GrpcRoute.RouteMatch"
        }
    }

    /// The destination to which traffic will be routed.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct Destination {
        /// Optional. Specifies the proportion of requests forwarded to the backend
        /// referenced by the serviceName field. This is computed as:
        ///
        /// - weight/Sum(weights in this destination list).
        ///   For non-zero values, there may be some epsilon from the exact proportion
        ///   defined here depending on the precision an implementation supports.
        ///
        /// If only one serviceName is specified and it has a weight greater than 0,
        /// 100% of the traffic is forwarded to that backend.
        ///
        /// If weights are specified for any one service name, they need to be
        /// specified for all of them.
        ///
        /// If weights are unspecified for all services, then, traffic is distributed
        /// in equal proportions to all of them.
        pub weight: std::option::Option<i32>,

        /// Specifies the kind of destination to which traffic will be routed.
        pub destination_type:
            std::option::Option<crate::model::grpc_route::destination::DestinationType>,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl Destination {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [weight][crate::model::grpc_route::Destination::weight].
        pub fn set_weight<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<i32>,
        {
            self.weight = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [weight][crate::model::grpc_route::Destination::weight].
        pub fn set_or_clear_weight<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<i32>,
        {
            self.weight = v.map(|x| x.into());
            self
        }

        /// Sets the value of [destination_type][crate::model::grpc_route::Destination::destination_type].
        ///
        /// Note that all the setters affecting `destination_type` are mutually
        /// exclusive.
        pub fn set_destination_type<
            T: std::convert::Into<
                    std::option::Option<crate::model::grpc_route::destination::DestinationType>,
                >,
        >(
            mut self,
            v: T,
        ) -> Self {
            self.destination_type = v.into();
            self
        }

        /// The value of [destination_type][crate::model::grpc_route::Destination::destination_type]
        /// if it holds a `ServiceName`, `None` if the field is not set or
        /// holds a different branch.
        pub fn service_name(&self) -> std::option::Option<&std::string::String> {
            #[allow(unreachable_patterns)]
            self.destination_type.as_ref().and_then(|v| match v {
                crate::model::grpc_route::destination::DestinationType::ServiceName(v) => {
                    std::option::Option::Some(v)
                }
                _ => std::option::Option::None,
            })
        }

        /// Sets the value of [destination_type][crate::model::grpc_route::Destination::destination_type]
        /// to hold a `ServiceName`.
        ///
        /// Note that all the setters affecting `destination_type` are
        /// mutually exclusive.
        pub fn set_service_name<T: std::convert::Into<std::string::String>>(
            mut self,
            v: T,
        ) -> Self {
            self.destination_type = std::option::Option::Some(
                crate::model::grpc_route::destination::DestinationType::ServiceName(v.into()),
            );
            self
        }
    }

    impl wkt::message::Message for Destination {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.networkservices.v1.GrpcRoute.Destination"
        }
    }

    /// Defines additional types related to [Destination].
    pub mod destination {
        #[allow(unused_imports)]
        use super::*;

        /// Specifies the kind of destination to which traffic will be routed.
        #[derive(Clone, Debug, PartialEq)]
        #[non_exhaustive]
        pub enum DestinationType {
            /// Required. The URL of a destination service to which to route traffic.
            /// Must refer to either a BackendService or ServiceDirectoryService.
            ServiceName(std::string::String),
        }
    }

    /// The specification for fault injection introduced into traffic to test the
    /// resiliency of clients to destination service failure. As part of fault
    /// injection, when clients send requests to a destination, delays can be
    /// introduced on a percentage of requests before sending those requests to the
    /// destination service. Similarly requests from clients can be aborted by for
    /// a percentage of requests.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct FaultInjectionPolicy {
        /// The specification for injecting delay to client requests.
        pub delay: std::option::Option<crate::model::grpc_route::fault_injection_policy::Delay>,

        /// The specification for aborting to client requests.
        pub abort: std::option::Option<crate::model::grpc_route::fault_injection_policy::Abort>,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl FaultInjectionPolicy {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [delay][crate::model::grpc_route::FaultInjectionPolicy::delay].
        pub fn set_delay<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<crate::model::grpc_route::fault_injection_policy::Delay>,
        {
            self.delay = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [delay][crate::model::grpc_route::FaultInjectionPolicy::delay].
        pub fn set_or_clear_delay<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<crate::model::grpc_route::fault_injection_policy::Delay>,
        {
            self.delay = v.map(|x| x.into());
            self
        }

        /// Sets the value of [abort][crate::model::grpc_route::FaultInjectionPolicy::abort].
        pub fn set_abort<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<crate::model::grpc_route::fault_injection_policy::Abort>,
        {
            self.abort = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [abort][crate::model::grpc_route::FaultInjectionPolicy::abort].
        pub fn set_or_clear_abort<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<crate::model::grpc_route::fault_injection_policy::Abort>,
        {
            self.abort = v.map(|x| x.into());
            self
        }
    }

    impl wkt::message::Message for FaultInjectionPolicy {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.networkservices.v1.GrpcRoute.FaultInjectionPolicy"
        }
    }

    /// Defines additional types related to [FaultInjectionPolicy].
    pub mod fault_injection_policy {
        #[allow(unused_imports)]
        use super::*;

        /// Specification of how client requests are delayed as part of fault
        /// injection before being sent to a destination.
        #[derive(Clone, Default, PartialEq)]
        #[non_exhaustive]
        pub struct Delay {
            /// Specify a fixed delay before forwarding the request.
            pub fixed_delay: std::option::Option<wkt::Duration>,

            /// The percentage of traffic on which delay will be injected.
            ///
            /// The value must be between [0, 100]
            pub percentage: std::option::Option<i32>,

            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
        }

        impl Delay {
            pub fn new() -> Self {
                std::default::Default::default()
            }

            /// Sets the value of [fixed_delay][crate::model::grpc_route::fault_injection_policy::Delay::fixed_delay].
            pub fn set_fixed_delay<T>(mut self, v: T) -> Self
            where
                T: std::convert::Into<wkt::Duration>,
            {
                self.fixed_delay = std::option::Option::Some(v.into());
                self
            }

            /// Sets or clears the value of [fixed_delay][crate::model::grpc_route::fault_injection_policy::Delay::fixed_delay].
            pub fn set_or_clear_fixed_delay<T>(mut self, v: std::option::Option<T>) -> Self
            where
                T: std::convert::Into<wkt::Duration>,
            {
                self.fixed_delay = v.map(|x| x.into());
                self
            }

            /// Sets the value of [percentage][crate::model::grpc_route::fault_injection_policy::Delay::percentage].
            pub fn set_percentage<T>(mut self, v: T) -> Self
            where
                T: std::convert::Into<i32>,
            {
                self.percentage = std::option::Option::Some(v.into());
                self
            }

            /// Sets or clears the value of [percentage][crate::model::grpc_route::fault_injection_policy::Delay::percentage].
            pub fn set_or_clear_percentage<T>(mut self, v: std::option::Option<T>) -> Self
            where
                T: std::convert::Into<i32>,
            {
                self.percentage = v.map(|x| x.into());
                self
            }
        }

        impl wkt::message::Message for Delay {
            fn typename() -> &'static str {
                "type.googleapis.com/google.cloud.networkservices.v1.GrpcRoute.FaultInjectionPolicy.Delay"
            }
        }

        /// Specification of how client requests are aborted as part of fault
        /// injection before being sent to a destination.
        #[derive(Clone, Default, PartialEq)]
        #[non_exhaustive]
        pub struct Abort {
            /// The HTTP status code used to abort the request.
            ///
            /// The value must be between 200 and 599 inclusive.
            pub http_status: std::option::Option<i32>,

            /// The percentage of traffic which will be aborted.
            ///
            /// The value must be between [0, 100]
            pub percentage: std::option::Option<i32>,

            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
        }

        impl Abort {
            pub fn new() -> Self {
                std::default::Default::default()
            }

            /// Sets the value of [http_status][crate::model::grpc_route::fault_injection_policy::Abort::http_status].
            pub fn set_http_status<T>(mut self, v: T) -> Self
            where
                T: std::convert::Into<i32>,
            {
                self.http_status = std::option::Option::Some(v.into());
                self
            }

            /// Sets or clears the value of [http_status][crate::model::grpc_route::fault_injection_policy::Abort::http_status].
            pub fn set_or_clear_http_status<T>(mut self, v: std::option::Option<T>) -> Self
            where
                T: std::convert::Into<i32>,
            {
                self.http_status = v.map(|x| x.into());
                self
            }

            /// Sets the value of [percentage][crate::model::grpc_route::fault_injection_policy::Abort::percentage].
            pub fn set_percentage<T>(mut self, v: T) -> Self
            where
                T: std::convert::Into<i32>,
            {
                self.percentage = std::option::Option::Some(v.into());
                self
            }

            /// Sets or clears the value of [percentage][crate::model::grpc_route::fault_injection_policy::Abort::percentage].
            pub fn set_or_clear_percentage<T>(mut self, v: std::option::Option<T>) -> Self
            where
                T: std::convert::Into<i32>,
            {
                self.percentage = v.map(|x| x.into());
                self
            }
        }

        impl wkt::message::Message for Abort {
            fn typename() -> &'static str {
                "type.googleapis.com/google.cloud.networkservices.v1.GrpcRoute.FaultInjectionPolicy.Abort"
            }
        }
    }

    /// The specification for cookie-based stateful session affinity where the
    /// date plane supplies a “session cookie”  with the name "GSSA" which encodes
    /// a specific destination host and each request containing that cookie will
    /// be directed to that host as long as the destination host remains up and
    /// healthy.
    ///
    /// The gRPC proxyless mesh library or sidecar proxy will manage the session
    /// cookie but the client application code is responsible for copying the
    /// cookie from each RPC in the session to the next.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct StatefulSessionAffinityPolicy {
        /// Required. The cookie TTL value for the Set-Cookie header generated by the
        /// data plane. The lifetime of the cookie may be set to a value from 0 to
        /// 86400 seconds (24 hours) inclusive.
        ///
        /// Set this to 0s to use a session cookie and disable cookie expiration.
        pub cookie_ttl: std::option::Option<wkt::Duration>,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl StatefulSessionAffinityPolicy {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [cookie_ttl][crate::model::grpc_route::StatefulSessionAffinityPolicy::cookie_ttl].
        pub fn set_cookie_ttl<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<wkt::Duration>,
        {
            self.cookie_ttl = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [cookie_ttl][crate::model::grpc_route::StatefulSessionAffinityPolicy::cookie_ttl].
        pub fn set_or_clear_cookie_ttl<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<wkt::Duration>,
        {
            self.cookie_ttl = v.map(|x| x.into());
            self
        }
    }

    impl wkt::message::Message for StatefulSessionAffinityPolicy {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.networkservices.v1.GrpcRoute.StatefulSessionAffinityPolicy"
        }
    }

    /// The specifications for retries.
    /// Specifies one or more conditions for which this retry rule applies. Valid
    /// values are:
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct RetryPolicy {
        /// - connect-failure: Router will retry on failures connecting to Backend
        ///   Services, for example due to connection timeouts.
        /// - refused-stream: Router will retry if the backend service resets the
        ///   stream
        ///   with a REFUSED_STREAM error code. This reset type indicates that it is
        ///   safe to retry.
        /// - cancelled: Router will retry if the gRPC status code in the response
        ///   header
        ///   is set to cancelled
        /// - deadline-exceeded: Router will retry if the gRPC status code in the
        ///   response
        ///   header is set to deadline-exceeded
        /// - resource-exhausted: Router will retry if the gRPC status code in the
        ///   response header is set to resource-exhausted
        /// - unavailable: Router will retry if the gRPC status code in the response
        ///   header is set to unavailable
        pub retry_conditions: std::vec::Vec<std::string::String>,

        /// Specifies the allowed number of retries. This number must be > 0. If not
        /// specified, default to 1.
        pub num_retries: u32,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl RetryPolicy {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [retry_conditions][crate::model::grpc_route::RetryPolicy::retry_conditions].
        pub fn set_retry_conditions<T, V>(mut self, v: T) -> Self
        where
            T: std::iter::IntoIterator<Item = V>,
            V: std::convert::Into<std::string::String>,
        {
            use std::iter::Iterator;
            self.retry_conditions = v.into_iter().map(|i| i.into()).collect();
            self
        }

        /// Sets the value of [num_retries][crate::model::grpc_route::RetryPolicy::num_retries].
        pub fn set_num_retries<T: std::convert::Into<u32>>(mut self, v: T) -> Self {
            self.num_retries = v.into();
            self
        }
    }

    impl wkt::message::Message for RetryPolicy {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.networkservices.v1.GrpcRoute.RetryPolicy"
        }
    }

    /// Specifies how to route matched traffic.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct RouteAction {
        /// Optional. The destination services to which traffic should be forwarded.
        /// If multiple destinations are specified, traffic will be split between
        /// Backend Service(s) according to the weight field of these destinations.
        pub destinations: std::vec::Vec<crate::model::grpc_route::Destination>,

        /// Optional. The specification for fault injection introduced into traffic
        /// to test the resiliency of clients to destination service failure. As part
        /// of fault injection, when clients send requests to a destination, delays
        /// can be introduced on a percentage of requests before sending those
        /// requests to the destination service. Similarly requests from clients can
        /// be aborted by for a percentage of requests.
        ///
        /// timeout and retry_policy will be ignored by clients that are configured
        /// with a fault_injection_policy
        pub fault_injection_policy:
            std::option::Option<crate::model::grpc_route::FaultInjectionPolicy>,

        /// Optional. Specifies the timeout for selected route. Timeout is computed
        /// from the time the request has been fully processed (i.e. end of stream)
        /// up until the response has been completely processed. Timeout includes all
        /// retries.
        pub timeout: std::option::Option<wkt::Duration>,

        /// Optional. Specifies the retry policy associated with this route.
        pub retry_policy: std::option::Option<crate::model::grpc_route::RetryPolicy>,

        /// Optional. Specifies cookie-based stateful session affinity.
        pub stateful_session_affinity:
            std::option::Option<crate::model::grpc_route::StatefulSessionAffinityPolicy>,

        /// Optional. Specifies the idle timeout for the selected route. The idle
        /// timeout is defined as the period in which there are no bytes sent or
        /// received on either the upstream or downstream connection. If not set, the
        /// default idle timeout is 1 hour. If set to 0s, the timeout will be
        /// disabled.
        pub idle_timeout: std::option::Option<wkt::Duration>,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl RouteAction {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [destinations][crate::model::grpc_route::RouteAction::destinations].
        pub fn set_destinations<T, V>(mut self, v: T) -> Self
        where
            T: std::iter::IntoIterator<Item = V>,
            V: std::convert::Into<crate::model::grpc_route::Destination>,
        {
            use std::iter::Iterator;
            self.destinations = v.into_iter().map(|i| i.into()).collect();
            self
        }

        /// Sets the value of [fault_injection_policy][crate::model::grpc_route::RouteAction::fault_injection_policy].
        pub fn set_fault_injection_policy<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<crate::model::grpc_route::FaultInjectionPolicy>,
        {
            self.fault_injection_policy = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [fault_injection_policy][crate::model::grpc_route::RouteAction::fault_injection_policy].
        pub fn set_or_clear_fault_injection_policy<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<crate::model::grpc_route::FaultInjectionPolicy>,
        {
            self.fault_injection_policy = v.map(|x| x.into());
            self
        }

        /// Sets the value of [timeout][crate::model::grpc_route::RouteAction::timeout].
        pub fn set_timeout<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<wkt::Duration>,
        {
            self.timeout = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [timeout][crate::model::grpc_route::RouteAction::timeout].
        pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<wkt::Duration>,
        {
            self.timeout = v.map(|x| x.into());
            self
        }

        /// Sets the value of [retry_policy][crate::model::grpc_route::RouteAction::retry_policy].
        pub fn set_retry_policy<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<crate::model::grpc_route::RetryPolicy>,
        {
            self.retry_policy = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [retry_policy][crate::model::grpc_route::RouteAction::retry_policy].
        pub fn set_or_clear_retry_policy<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<crate::model::grpc_route::RetryPolicy>,
        {
            self.retry_policy = v.map(|x| x.into());
            self
        }

        /// Sets the value of [stateful_session_affinity][crate::model::grpc_route::RouteAction::stateful_session_affinity].
        pub fn set_stateful_session_affinity<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<crate::model::grpc_route::StatefulSessionAffinityPolicy>,
        {
            self.stateful_session_affinity = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [stateful_session_affinity][crate::model::grpc_route::RouteAction::stateful_session_affinity].
        pub fn set_or_clear_stateful_session_affinity<T>(
            mut self,
            v: std::option::Option<T>,
        ) -> Self
        where
            T: std::convert::Into<crate::model::grpc_route::StatefulSessionAffinityPolicy>,
        {
            self.stateful_session_affinity = v.map(|x| x.into());
            self
        }

        /// Sets the value of [idle_timeout][crate::model::grpc_route::RouteAction::idle_timeout].
        pub fn set_idle_timeout<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<wkt::Duration>,
        {
            self.idle_timeout = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [idle_timeout][crate::model::grpc_route::RouteAction::idle_timeout].
        pub fn set_or_clear_idle_timeout<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<wkt::Duration>,
        {
            self.idle_timeout = v.map(|x| x.into());
            self
        }
    }

    impl wkt::message::Message for RouteAction {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.networkservices.v1.GrpcRoute.RouteAction"
        }
    }

    /// Describes how to route traffic.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct RouteRule {
        /// Optional. Matches define conditions used for matching the rule against
        /// incoming gRPC requests. Each match is independent, i.e. this rule will be
        /// matched if ANY one of the matches is satisfied.  If no matches field is
        /// specified, this rule will unconditionally match traffic.
        pub matches: std::vec::Vec<crate::model::grpc_route::RouteMatch>,

        /// Required. A detailed rule defining how to route traffic. This field is
        /// required.
        pub action: std::option::Option<crate::model::grpc_route::RouteAction>,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl RouteRule {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [matches][crate::model::grpc_route::RouteRule::matches].
        pub fn set_matches<T, V>(mut self, v: T) -> Self
        where
            T: std::iter::IntoIterator<Item = V>,
            V: std::convert::Into<crate::model::grpc_route::RouteMatch>,
        {
            use std::iter::Iterator;
            self.matches = v.into_iter().map(|i| i.into()).collect();
            self
        }

        /// Sets the value of [action][crate::model::grpc_route::RouteRule::action].
        pub fn set_action<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<crate::model::grpc_route::RouteAction>,
        {
            self.action = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [action][crate::model::grpc_route::RouteRule::action].
        pub fn set_or_clear_action<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<crate::model::grpc_route::RouteAction>,
        {
            self.action = v.map(|x| x.into());
            self
        }
    }

    impl wkt::message::Message for RouteRule {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.networkservices.v1.GrpcRoute.RouteRule"
        }
    }
}

/// Request used with the ListGrpcRoutes method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListGrpcRoutesRequest {
    /// Required. The project and location from which the GrpcRoutes should be
    /// listed, specified in the format `projects/*/locations/global`.
    pub parent: std::string::String,

    /// Maximum number of GrpcRoutes to return per call.
    pub page_size: i32,

    /// The value returned by the last `ListGrpcRoutesResponse`
    /// Indicates that this is a continuation of a prior `ListGrpcRoutes` call,
    /// and that the system should return the next page of data.
    pub page_token: std::string::String,

    /// Optional. If true, allow partial responses for multi-regional Aggregated
    /// List requests. Otherwise if one of the locations is down or unreachable,
    /// the Aggregated List request will fail.
    pub return_partial_success: bool,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListGrpcRoutesRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::ListGrpcRoutesRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [page_size][crate::model::ListGrpcRoutesRequest::page_size].
    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.page_size = v.into();
        self
    }

    /// Sets the value of [page_token][crate::model::ListGrpcRoutesRequest::page_token].
    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.page_token = v.into();
        self
    }

    /// Sets the value of [return_partial_success][crate::model::ListGrpcRoutesRequest::return_partial_success].
    pub fn set_return_partial_success<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.return_partial_success = v.into();
        self
    }
}

impl wkt::message::Message for ListGrpcRoutesRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.ListGrpcRoutesRequest"
    }
}

/// Response returned by the ListGrpcRoutes method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListGrpcRoutesResponse {
    /// List of GrpcRoute resources.
    pub grpc_routes: std::vec::Vec<crate::model::GrpcRoute>,

    /// If there might be more results than those appearing in this response, then
    /// `next_page_token` is included. To get the next set of results, call this
    /// method again using the value of `next_page_token` as `page_token`.
    pub next_page_token: std::string::String,

    /// Unreachable resources. Populated when the request opts into
    /// [return_partial_success][google.cloud.networkservices.v1.ListGrpcRoutesRequest.return_partial_success]
    /// and reading across collections e.g. when attempting to list all resources
    /// across all supported locations.
    ///
    /// [google.cloud.networkservices.v1.ListGrpcRoutesRequest.return_partial_success]: crate::model::ListGrpcRoutesRequest::return_partial_success
    pub unreachable: std::vec::Vec<std::string::String>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListGrpcRoutesResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [grpc_routes][crate::model::ListGrpcRoutesResponse::grpc_routes].
    pub fn set_grpc_routes<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::GrpcRoute>,
    {
        use std::iter::Iterator;
        self.grpc_routes = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [next_page_token][crate::model::ListGrpcRoutesResponse::next_page_token].
    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.next_page_token = v.into();
        self
    }

    /// Sets the value of [unreachable][crate::model::ListGrpcRoutesResponse::unreachable].
    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.unreachable = v.into_iter().map(|i| i.into()).collect();
        self
    }
}

impl wkt::message::Message for ListGrpcRoutesResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.ListGrpcRoutesResponse"
    }
}

#[doc(hidden)]
impl gax::paginator::internal::PageableResponse for ListGrpcRoutesResponse {
    type PageItem = crate::model::GrpcRoute;

    fn items(self) -> std::vec::Vec<Self::PageItem> {
        self.grpc_routes
    }

    fn next_page_token(&self) -> std::string::String {
        use std::clone::Clone;
        self.next_page_token.clone()
    }
}

/// Request used by the GetGrpcRoute method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetGrpcRouteRequest {
    /// Required. A name of the GrpcRoute to get. Must be in the format
    /// `projects/*/locations/global/grpcRoutes/*`.
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GetGrpcRouteRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::GetGrpcRouteRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for GetGrpcRouteRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.GetGrpcRouteRequest"
    }
}

/// Request used by the CreateGrpcRoute method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateGrpcRouteRequest {
    /// Required. The parent resource of the GrpcRoute. Must be in the
    /// format `projects/*/locations/global`.
    pub parent: std::string::String,

    /// Required. Short name of the GrpcRoute resource to be created.
    pub grpc_route_id: std::string::String,

    /// Required. GrpcRoute resource to be created.
    pub grpc_route: std::option::Option<crate::model::GrpcRoute>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl CreateGrpcRouteRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::CreateGrpcRouteRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [grpc_route_id][crate::model::CreateGrpcRouteRequest::grpc_route_id].
    pub fn set_grpc_route_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.grpc_route_id = v.into();
        self
    }

    /// Sets the value of [grpc_route][crate::model::CreateGrpcRouteRequest::grpc_route].
    pub fn set_grpc_route<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::GrpcRoute>,
    {
        self.grpc_route = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [grpc_route][crate::model::CreateGrpcRouteRequest::grpc_route].
    pub fn set_or_clear_grpc_route<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::GrpcRoute>,
    {
        self.grpc_route = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for CreateGrpcRouteRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.CreateGrpcRouteRequest"
    }
}

/// Request used by the UpdateGrpcRoute method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateGrpcRouteRequest {
    /// Optional. Field mask is used to specify the fields to be overwritten in the
    /// GrpcRoute resource by the update.
    /// The fields specified in the update_mask are relative to the resource, not
    /// the full request. A field will be overwritten if it is in the mask. If the
    /// user does not provide a mask then all fields will be overwritten.
    pub update_mask: std::option::Option<wkt::FieldMask>,

    /// Required. Updated GrpcRoute resource.
    pub grpc_route: std::option::Option<crate::model::GrpcRoute>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl UpdateGrpcRouteRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [update_mask][crate::model::UpdateGrpcRouteRequest::update_mask].
    pub fn set_update_mask<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_mask][crate::model::UpdateGrpcRouteRequest::update_mask].
    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = v.map(|x| x.into());
        self
    }

    /// Sets the value of [grpc_route][crate::model::UpdateGrpcRouteRequest::grpc_route].
    pub fn set_grpc_route<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::GrpcRoute>,
    {
        self.grpc_route = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [grpc_route][crate::model::UpdateGrpcRouteRequest::grpc_route].
    pub fn set_or_clear_grpc_route<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::GrpcRoute>,
    {
        self.grpc_route = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for UpdateGrpcRouteRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.UpdateGrpcRouteRequest"
    }
}

/// Request used by the DeleteGrpcRoute method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteGrpcRouteRequest {
    /// Required. A name of the GrpcRoute to delete. Must be in the format
    /// `projects/*/locations/global/grpcRoutes/*`.
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl DeleteGrpcRouteRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::DeleteGrpcRouteRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for DeleteGrpcRouteRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.DeleteGrpcRouteRequest"
    }
}

/// HttpRoute is the resource defining how HTTP traffic should be routed by a
/// Mesh or Gateway resource.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct HttpRoute {
    /// Identifier. Name of the HttpRoute resource. It matches pattern
    /// `projects/*/locations/global/httpRoutes/http_route_name>`.
    pub name: std::string::String,

    /// Output only. Server-defined URL of this resource
    pub self_link: std::string::String,

    /// Optional. A free-text description of the resource. Max length 1024
    /// characters.
    pub description: std::string::String,

    /// Output only. The timestamp when the resource was created.
    pub create_time: std::option::Option<wkt::Timestamp>,

    /// Output only. The timestamp when the resource was updated.
    pub update_time: std::option::Option<wkt::Timestamp>,

    /// Required. Hostnames define a set of hosts that should match against the
    /// HTTP host header to select a HttpRoute to process the request. Hostname is
    /// the fully qualified domain name of a network host, as defined by RFC 1123
    /// with the exception that:
    ///
    /// - IPs are not allowed.
    /// - A hostname may be prefixed with a wildcard label (`*.`). The wildcard
    ///   label must appear by itself as the first label.
    ///
    /// Hostname can be "precise" which is a domain name without the terminating
    /// dot of a network host (e.g. `foo.example.com`) or "wildcard", which is a
    /// domain name prefixed with a single wildcard label (e.g. `*.example.com`).
    ///
    /// Note that as per RFC1035 and RFC1123, a label must consist of lower case
    /// alphanumeric characters or '-', and must start and end with an alphanumeric
    /// character. No other punctuation is allowed.
    ///
    /// The routes associated with a Mesh or Gateways  must have unique hostnames.
    /// If you attempt to attach multiple routes with conflicting hostnames,
    /// the configuration will be rejected.
    ///
    /// For example, while it is acceptable for routes for the hostnames
    /// `*.foo.bar.com` and `*.bar.com` to be associated with the same Mesh (or
    /// Gateways under the same scope), it is not possible to associate two routes
    /// both with `*.bar.com` or both with `bar.com`.
    pub hostnames: std::vec::Vec<std::string::String>,

    /// Optional. Meshes defines a list of meshes this HttpRoute is attached to, as
    /// one of the routing rules to route the requests served by the mesh.
    ///
    /// Each mesh reference should match the pattern:
    /// `projects/*/locations/global/meshes/<mesh_name>`
    ///
    /// The attached Mesh should be of a type SIDECAR
    pub meshes: std::vec::Vec<std::string::String>,

    /// Optional. Gateways defines a list of gateways this HttpRoute is attached
    /// to, as one of the routing rules to route the requests served by the
    /// gateway.
    ///
    /// Each gateway reference should match the pattern:
    /// `projects/*/locations/global/gateways/<gateway_name>`
    pub gateways: std::vec::Vec<std::string::String>,

    /// Optional. Set of label tags associated with the HttpRoute resource.
    pub labels: std::collections::HashMap<std::string::String, std::string::String>,

    /// Required. Rules that define how traffic is routed and handled.
    /// Rules will be matched sequentially based on the RouteMatch specified for
    /// the rule.
    pub rules: std::vec::Vec<crate::model::http_route::RouteRule>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl HttpRoute {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::HttpRoute::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [self_link][crate::model::HttpRoute::self_link].
    pub fn set_self_link<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.self_link = v.into();
        self
    }

    /// Sets the value of [description][crate::model::HttpRoute::description].
    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.description = v.into();
        self
    }

    /// Sets the value of [create_time][crate::model::HttpRoute::create_time].
    pub fn set_create_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [create_time][crate::model::HttpRoute::create_time].
    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [update_time][crate::model::HttpRoute::update_time].
    pub fn set_update_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_time][crate::model::HttpRoute::update_time].
    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [hostnames][crate::model::HttpRoute::hostnames].
    pub fn set_hostnames<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.hostnames = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [meshes][crate::model::HttpRoute::meshes].
    pub fn set_meshes<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.meshes = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [gateways][crate::model::HttpRoute::gateways].
    pub fn set_gateways<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.gateways = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [labels][crate::model::HttpRoute::labels].
    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<std::string::String>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }

    /// Sets the value of [rules][crate::model::HttpRoute::rules].
    pub fn set_rules<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::http_route::RouteRule>,
    {
        use std::iter::Iterator;
        self.rules = v.into_iter().map(|i| i.into()).collect();
        self
    }
}

impl wkt::message::Message for HttpRoute {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.HttpRoute"
    }
}

/// Defines additional types related to [HttpRoute].
pub mod http_route {
    #[allow(unused_imports)]
    use super::*;

    /// Specifies how to select a route rule based on HTTP request headers.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct HeaderMatch {
        /// The name of the HTTP header to match against.
        pub header: std::string::String,

        /// If specified, the match result will be inverted before checking. Default
        /// value is set to false.
        pub invert_match: bool,

        pub match_type: std::option::Option<crate::model::http_route::header_match::MatchType>,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl HeaderMatch {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [header][crate::model::http_route::HeaderMatch::header].
        pub fn set_header<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
            self.header = v.into();
            self
        }

        /// Sets the value of [invert_match][crate::model::http_route::HeaderMatch::invert_match].
        pub fn set_invert_match<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
            self.invert_match = v.into();
            self
        }

        /// Sets the value of [match_type][crate::model::http_route::HeaderMatch::match_type].
        ///
        /// Note that all the setters affecting `match_type` are mutually
        /// exclusive.
        pub fn set_match_type<
            T: std::convert::Into<
                    std::option::Option<crate::model::http_route::header_match::MatchType>,
                >,
        >(
            mut self,
            v: T,
        ) -> Self {
            self.match_type = v.into();
            self
        }

        /// The value of [match_type][crate::model::http_route::HeaderMatch::match_type]
        /// if it holds a `ExactMatch`, `None` if the field is not set or
        /// holds a different branch.
        pub fn exact_match(&self) -> std::option::Option<&std::string::String> {
            #[allow(unreachable_patterns)]
            self.match_type.as_ref().and_then(|v| match v {
                crate::model::http_route::header_match::MatchType::ExactMatch(v) => {
                    std::option::Option::Some(v)
                }
                _ => std::option::Option::None,
            })
        }

        /// Sets the value of [match_type][crate::model::http_route::HeaderMatch::match_type]
        /// to hold a `ExactMatch`.
        ///
        /// Note that all the setters affecting `match_type` are
        /// mutually exclusive.
        pub fn set_exact_match<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
            self.match_type = std::option::Option::Some(
                crate::model::http_route::header_match::MatchType::ExactMatch(v.into()),
            );
            self
        }

        /// The value of [match_type][crate::model::http_route::HeaderMatch::match_type]
        /// if it holds a `RegexMatch`, `None` if the field is not set or
        /// holds a different branch.
        pub fn regex_match(&self) -> std::option::Option<&std::string::String> {
            #[allow(unreachable_patterns)]
            self.match_type.as_ref().and_then(|v| match v {
                crate::model::http_route::header_match::MatchType::RegexMatch(v) => {
                    std::option::Option::Some(v)
                }
                _ => std::option::Option::None,
            })
        }

        /// Sets the value of [match_type][crate::model::http_route::HeaderMatch::match_type]
        /// to hold a `RegexMatch`.
        ///
        /// Note that all the setters affecting `match_type` are
        /// mutually exclusive.
        pub fn set_regex_match<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
            self.match_type = std::option::Option::Some(
                crate::model::http_route::header_match::MatchType::RegexMatch(v.into()),
            );
            self
        }

        /// The value of [match_type][crate::model::http_route::HeaderMatch::match_type]
        /// if it holds a `PrefixMatch`, `None` if the field is not set or
        /// holds a different branch.
        pub fn prefix_match(&self) -> std::option::Option<&std::string::String> {
            #[allow(unreachable_patterns)]
            self.match_type.as_ref().and_then(|v| match v {
                crate::model::http_route::header_match::MatchType::PrefixMatch(v) => {
                    std::option::Option::Some(v)
                }
                _ => std::option::Option::None,
            })
        }

        /// Sets the value of [match_type][crate::model::http_route::HeaderMatch::match_type]
        /// to hold a `PrefixMatch`.
        ///
        /// Note that all the setters affecting `match_type` are
        /// mutually exclusive.
        pub fn set_prefix_match<T: std::convert::Into<std::string::String>>(
            mut self,
            v: T,
        ) -> Self {
            self.match_type = std::option::Option::Some(
                crate::model::http_route::header_match::MatchType::PrefixMatch(v.into()),
            );
            self
        }

        /// The value of [match_type][crate::model::http_route::HeaderMatch::match_type]
        /// if it holds a `PresentMatch`, `None` if the field is not set or
        /// holds a different branch.
        pub fn present_match(&self) -> std::option::Option<&bool> {
            #[allow(unreachable_patterns)]
            self.match_type.as_ref().and_then(|v| match v {
                crate::model::http_route::header_match::MatchType::PresentMatch(v) => {
                    std::option::Option::Some(v)
                }
                _ => std::option::Option::None,
            })
        }

        /// Sets the value of [match_type][crate::model::http_route::HeaderMatch::match_type]
        /// to hold a `PresentMatch`.
        ///
        /// Note that all the setters affecting `match_type` are
        /// mutually exclusive.
        pub fn set_present_match<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
            self.match_type = std::option::Option::Some(
                crate::model::http_route::header_match::MatchType::PresentMatch(v.into()),
            );
            self
        }

        /// The value of [match_type][crate::model::http_route::HeaderMatch::match_type]
        /// if it holds a `SuffixMatch`, `None` if the field is not set or
        /// holds a different branch.
        pub fn suffix_match(&self) -> std::option::Option<&std::string::String> {
            #[allow(unreachable_patterns)]
            self.match_type.as_ref().and_then(|v| match v {
                crate::model::http_route::header_match::MatchType::SuffixMatch(v) => {
                    std::option::Option::Some(v)
                }
                _ => std::option::Option::None,
            })
        }

        /// Sets the value of [match_type][crate::model::http_route::HeaderMatch::match_type]
        /// to hold a `SuffixMatch`.
        ///
        /// Note that all the setters affecting `match_type` are
        /// mutually exclusive.
        pub fn set_suffix_match<T: std::convert::Into<std::string::String>>(
            mut self,
            v: T,
        ) -> Self {
            self.match_type = std::option::Option::Some(
                crate::model::http_route::header_match::MatchType::SuffixMatch(v.into()),
            );
            self
        }

        /// The value of [match_type][crate::model::http_route::HeaderMatch::match_type]
        /// if it holds a `RangeMatch`, `None` if the field is not set or
        /// holds a different branch.
        pub fn range_match(
            &self,
        ) -> std::option::Option<
            &std::boxed::Box<crate::model::http_route::header_match::IntegerRange>,
        > {
            #[allow(unreachable_patterns)]
            self.match_type.as_ref().and_then(|v| match v {
                crate::model::http_route::header_match::MatchType::RangeMatch(v) => {
                    std::option::Option::Some(v)
                }
                _ => std::option::Option::None,
            })
        }

        /// Sets the value of [match_type][crate::model::http_route::HeaderMatch::match_type]
        /// to hold a `RangeMatch`.
        ///
        /// Note that all the setters affecting `match_type` are
        /// mutually exclusive.
        pub fn set_range_match<
            T: std::convert::Into<
                    std::boxed::Box<crate::model::http_route::header_match::IntegerRange>,
                >,
        >(
            mut self,
            v: T,
        ) -> Self {
            self.match_type = std::option::Option::Some(
                crate::model::http_route::header_match::MatchType::RangeMatch(v.into()),
            );
            self
        }
    }

    impl wkt::message::Message for HeaderMatch {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.networkservices.v1.HttpRoute.HeaderMatch"
        }
    }

    /// Defines additional types related to [HeaderMatch].
    pub mod header_match {
        #[allow(unused_imports)]
        use super::*;

        /// Represents an integer value range.
        #[derive(Clone, Default, PartialEq)]
        #[non_exhaustive]
        pub struct IntegerRange {
            /// Start of the range (inclusive)
            pub start: i32,

            /// End of the range (exclusive)
            pub end: i32,

            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
        }

        impl IntegerRange {
            pub fn new() -> Self {
                std::default::Default::default()
            }

            /// Sets the value of [start][crate::model::http_route::header_match::IntegerRange::start].
            pub fn set_start<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
                self.start = v.into();
                self
            }

            /// Sets the value of [end][crate::model::http_route::header_match::IntegerRange::end].
            pub fn set_end<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
                self.end = v.into();
                self
            }
        }

        impl wkt::message::Message for IntegerRange {
            fn typename() -> &'static str {
                "type.googleapis.com/google.cloud.networkservices.v1.HttpRoute.HeaderMatch.IntegerRange"
            }
        }

        #[derive(Clone, Debug, PartialEq)]
        #[non_exhaustive]
        pub enum MatchType {
            /// The value of the header should match exactly the content of
            /// exact_match.
            ExactMatch(std::string::String),
            /// The value of the header must match the regular expression specified in
            /// regex_match. For regular expression grammar, please see:
            /// <https://github.com/google/re2/wiki/Syntax>
            RegexMatch(std::string::String),
            /// The value of the header must start with the contents of prefix_match.
            PrefixMatch(std::string::String),
            /// A header with header_name must exist. The match takes place whether or
            /// not the header has a value.
            PresentMatch(bool),
            /// The value of the header must end with the contents of suffix_match.
            SuffixMatch(std::string::String),
            /// If specified, the rule will match if the request header value is within
            /// the range.
            RangeMatch(std::boxed::Box<crate::model::http_route::header_match::IntegerRange>),
        }
    }

    /// Specifications to match a query parameter in the request.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct QueryParameterMatch {
        /// The name of the query parameter to match.
        pub query_parameter: std::string::String,

        pub match_type:
            std::option::Option<crate::model::http_route::query_parameter_match::MatchType>,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl QueryParameterMatch {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [query_parameter][crate::model::http_route::QueryParameterMatch::query_parameter].
        pub fn set_query_parameter<T: std::convert::Into<std::string::String>>(
            mut self,
            v: T,
        ) -> Self {
            self.query_parameter = v.into();
            self
        }

        /// Sets the value of [match_type][crate::model::http_route::QueryParameterMatch::match_type].
        ///
        /// Note that all the setters affecting `match_type` are mutually
        /// exclusive.
        pub fn set_match_type<
            T: std::convert::Into<
                    std::option::Option<crate::model::http_route::query_parameter_match::MatchType>,
                >,
        >(
            mut self,
            v: T,
        ) -> Self {
            self.match_type = v.into();
            self
        }

        /// The value of [match_type][crate::model::http_route::QueryParameterMatch::match_type]
        /// if it holds a `ExactMatch`, `None` if the field is not set or
        /// holds a different branch.
        pub fn exact_match(&self) -> std::option::Option<&std::string::String> {
            #[allow(unreachable_patterns)]
            self.match_type.as_ref().and_then(|v| match v {
                crate::model::http_route::query_parameter_match::MatchType::ExactMatch(v) => {
                    std::option::Option::Some(v)
                }
                _ => std::option::Option::None,
            })
        }

        /// Sets the value of [match_type][crate::model::http_route::QueryParameterMatch::match_type]
        /// to hold a `ExactMatch`.
        ///
        /// Note that all the setters affecting `match_type` are
        /// mutually exclusive.
        pub fn set_exact_match<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
            self.match_type = std::option::Option::Some(
                crate::model::http_route::query_parameter_match::MatchType::ExactMatch(v.into()),
            );
            self
        }

        /// The value of [match_type][crate::model::http_route::QueryParameterMatch::match_type]
        /// if it holds a `RegexMatch`, `None` if the field is not set or
        /// holds a different branch.
        pub fn regex_match(&self) -> std::option::Option<&std::string::String> {
            #[allow(unreachable_patterns)]
            self.match_type.as_ref().and_then(|v| match v {
                crate::model::http_route::query_parameter_match::MatchType::RegexMatch(v) => {
                    std::option::Option::Some(v)
                }
                _ => std::option::Option::None,
            })
        }

        /// Sets the value of [match_type][crate::model::http_route::QueryParameterMatch::match_type]
        /// to hold a `RegexMatch`.
        ///
        /// Note that all the setters affecting `match_type` are
        /// mutually exclusive.
        pub fn set_regex_match<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
            self.match_type = std::option::Option::Some(
                crate::model::http_route::query_parameter_match::MatchType::RegexMatch(v.into()),
            );
            self
        }

        /// The value of [match_type][crate::model::http_route::QueryParameterMatch::match_type]
        /// if it holds a `PresentMatch`, `None` if the field is not set or
        /// holds a different branch.
        pub fn present_match(&self) -> std::option::Option<&bool> {
            #[allow(unreachable_patterns)]
            self.match_type.as_ref().and_then(|v| match v {
                crate::model::http_route::query_parameter_match::MatchType::PresentMatch(v) => {
                    std::option::Option::Some(v)
                }
                _ => std::option::Option::None,
            })
        }

        /// Sets the value of [match_type][crate::model::http_route::QueryParameterMatch::match_type]
        /// to hold a `PresentMatch`.
        ///
        /// Note that all the setters affecting `match_type` are
        /// mutually exclusive.
        pub fn set_present_match<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
            self.match_type = std::option::Option::Some(
                crate::model::http_route::query_parameter_match::MatchType::PresentMatch(v.into()),
            );
            self
        }
    }

    impl wkt::message::Message for QueryParameterMatch {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.networkservices.v1.HttpRoute.QueryParameterMatch"
        }
    }

    /// Defines additional types related to [QueryParameterMatch].
    pub mod query_parameter_match {
        #[allow(unused_imports)]
        use super::*;

        #[derive(Clone, Debug, PartialEq)]
        #[non_exhaustive]
        pub enum MatchType {
            /// The value of the query parameter must exactly match the contents of
            /// exact_match.
            ///
            /// Only one of exact_match, regex_match, or present_match must be set.
            ExactMatch(std::string::String),
            /// The value of the query parameter must match the regular expression
            /// specified by regex_match. For regular expression grammar, please see
            /// <https://github.com/google/re2/wiki/Syntax>
            ///
            /// Only one of exact_match, regex_match, or present_match must be set.
            RegexMatch(std::string::String),
            /// Specifies that the QueryParameterMatcher matches if request contains
            /// query parameter, irrespective of whether the parameter has a value or
            /// not.
            ///
            /// Only one of exact_match, regex_match, or present_match must be set.
            PresentMatch(bool),
        }
    }

    /// RouteMatch defines specifications used to match requests. If multiple match
    /// types are set, this RouteMatch will match if ALL type of matches are
    /// matched.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct RouteMatch {
        /// Specifies if prefix_match and full_path_match matches are case sensitive.
        /// The default value is false.
        pub ignore_case: bool,

        /// Specifies a list of HTTP request headers to match against. ALL of the
        /// supplied headers must be matched.
        pub headers: std::vec::Vec<crate::model::http_route::HeaderMatch>,

        /// Specifies a list of query parameters to match against. ALL of the query
        /// parameters must be matched.
        pub query_parameters: std::vec::Vec<crate::model::http_route::QueryParameterMatch>,

        pub path_match: std::option::Option<crate::model::http_route::route_match::PathMatch>,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl RouteMatch {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [ignore_case][crate::model::http_route::RouteMatch::ignore_case].
        pub fn set_ignore_case<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
            self.ignore_case = v.into();
            self
        }

        /// Sets the value of [headers][crate::model::http_route::RouteMatch::headers].
        pub fn set_headers<T, V>(mut self, v: T) -> Self
        where
            T: std::iter::IntoIterator<Item = V>,
            V: std::convert::Into<crate::model::http_route::HeaderMatch>,
        {
            use std::iter::Iterator;
            self.headers = v.into_iter().map(|i| i.into()).collect();
            self
        }

        /// Sets the value of [query_parameters][crate::model::http_route::RouteMatch::query_parameters].
        pub fn set_query_parameters<T, V>(mut self, v: T) -> Self
        where
            T: std::iter::IntoIterator<Item = V>,
            V: std::convert::Into<crate::model::http_route::QueryParameterMatch>,
        {
            use std::iter::Iterator;
            self.query_parameters = v.into_iter().map(|i| i.into()).collect();
            self
        }

        /// Sets the value of [path_match][crate::model::http_route::RouteMatch::path_match].
        ///
        /// Note that all the setters affecting `path_match` are mutually
        /// exclusive.
        pub fn set_path_match<
            T: std::convert::Into<
                    std::option::Option<crate::model::http_route::route_match::PathMatch>,
                >,
        >(
            mut self,
            v: T,
        ) -> Self {
            self.path_match = v.into();
            self
        }

        /// The value of [path_match][crate::model::http_route::RouteMatch::path_match]
        /// if it holds a `FullPathMatch`, `None` if the field is not set or
        /// holds a different branch.
        pub fn full_path_match(&self) -> std::option::Option<&std::string::String> {
            #[allow(unreachable_patterns)]
            self.path_match.as_ref().and_then(|v| match v {
                crate::model::http_route::route_match::PathMatch::FullPathMatch(v) => {
                    std::option::Option::Some(v)
                }
                _ => std::option::Option::None,
            })
        }

        /// Sets the value of [path_match][crate::model::http_route::RouteMatch::path_match]
        /// to hold a `FullPathMatch`.
        ///
        /// Note that all the setters affecting `path_match` are
        /// mutually exclusive.
        pub fn set_full_path_match<T: std::convert::Into<std::string::String>>(
            mut self,
            v: T,
        ) -> Self {
            self.path_match = std::option::Option::Some(
                crate::model::http_route::route_match::PathMatch::FullPathMatch(v.into()),
            );
            self
        }

        /// The value of [path_match][crate::model::http_route::RouteMatch::path_match]
        /// if it holds a `PrefixMatch`, `None` if the field is not set or
        /// holds a different branch.
        pub fn prefix_match(&self) -> std::option::Option<&std::string::String> {
            #[allow(unreachable_patterns)]
            self.path_match.as_ref().and_then(|v| match v {
                crate::model::http_route::route_match::PathMatch::PrefixMatch(v) => {
                    std::option::Option::Some(v)
                }
                _ => std::option::Option::None,
            })
        }

        /// Sets the value of [path_match][crate::model::http_route::RouteMatch::path_match]
        /// to hold a `PrefixMatch`.
        ///
        /// Note that all the setters affecting `path_match` are
        /// mutually exclusive.
        pub fn set_prefix_match<T: std::convert::Into<std::string::String>>(
            mut self,
            v: T,
        ) -> Self {
            self.path_match = std::option::Option::Some(
                crate::model::http_route::route_match::PathMatch::PrefixMatch(v.into()),
            );
            self
        }

        /// The value of [path_match][crate::model::http_route::RouteMatch::path_match]
        /// if it holds a `RegexMatch`, `None` if the field is not set or
        /// holds a different branch.
        pub fn regex_match(&self) -> std::option::Option<&std::string::String> {
            #[allow(unreachable_patterns)]
            self.path_match.as_ref().and_then(|v| match v {
                crate::model::http_route::route_match::PathMatch::RegexMatch(v) => {
                    std::option::Option::Some(v)
                }
                _ => std::option::Option::None,
            })
        }

        /// Sets the value of [path_match][crate::model::http_route::RouteMatch::path_match]
        /// to hold a `RegexMatch`.
        ///
        /// Note that all the setters affecting `path_match` are
        /// mutually exclusive.
        pub fn set_regex_match<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
            self.path_match = std::option::Option::Some(
                crate::model::http_route::route_match::PathMatch::RegexMatch(v.into()),
            );
            self
        }
    }

    impl wkt::message::Message for RouteMatch {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.networkservices.v1.HttpRoute.RouteMatch"
        }
    }

    /// Defines additional types related to [RouteMatch].
    pub mod route_match {
        #[allow(unused_imports)]
        use super::*;

        #[derive(Clone, Debug, PartialEq)]
        #[non_exhaustive]
        pub enum PathMatch {
            /// The HTTP request path value should exactly match this value.
            ///
            /// Only one of full_path_match, prefix_match, or regex_match should be
            /// used.
            FullPathMatch(std::string::String),
            /// The HTTP request path value must begin with specified prefix_match.
            /// prefix_match must begin with a /.
            ///
            /// Only one of full_path_match, prefix_match, or regex_match should be
            /// used.
            PrefixMatch(std::string::String),
            /// The HTTP request path value must satisfy the regular expression
            /// specified by regex_match after removing any query parameters and anchor
            /// supplied with the original URL. For regular expression grammar, please
            /// see <https://github.com/google/re2/wiki/Syntax>
            ///
            /// Only one of full_path_match, prefix_match, or regex_match should be
            /// used.
            RegexMatch(std::string::String),
        }
    }

    /// Specifications of a destination to which the request should be routed to.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct Destination {
        /// The URL of a BackendService to route traffic to.
        pub service_name: std::string::String,

        /// Specifies the proportion of requests forwarded to the backend referenced
        /// by the serviceName field. This is computed as:
        ///
        /// - weight/Sum(weights in this destination list).
        ///   For non-zero values, there may be some epsilon from the exact proportion
        ///   defined here depending on the precision an implementation supports.
        ///
        /// If only one serviceName is specified and it has a weight greater than 0,
        /// 100% of the traffic is forwarded to that backend.
        ///
        /// If weights are specified for any one service name, they need to be
        /// specified for all of them.
        ///
        /// If weights are unspecified for all services, then, traffic is distributed
        /// in equal proportions to all of them.
        pub weight: i32,

        /// Optional. The specification for modifying the headers of a matching
        /// request prior to delivery of the request to the destination. If
        /// HeaderModifiers are set on both the Destination and the RouteAction, they
        /// will be merged. Conflicts between the two will not be resolved on the
        /// configuration.
        pub request_header_modifier: std::option::Option<crate::model::http_route::HeaderModifier>,

        /// Optional. The specification for modifying the headers of a response prior
        /// to sending the response back to the client. If HeaderModifiers are set on
        /// both the Destination and the RouteAction, they will be merged. Conflicts
        /// between the two will not be resolved on the configuration.
        pub response_header_modifier: std::option::Option<crate::model::http_route::HeaderModifier>,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl Destination {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [service_name][crate::model::http_route::Destination::service_name].
        pub fn set_service_name<T: std::convert::Into<std::string::String>>(
            mut self,
            v: T,
        ) -> Self {
            self.service_name = v.into();
            self
        }

        /// Sets the value of [weight][crate::model::http_route::Destination::weight].
        pub fn set_weight<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
            self.weight = v.into();
            self
        }

        /// Sets the value of [request_header_modifier][crate::model::http_route::Destination::request_header_modifier].
        pub fn set_request_header_modifier<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<crate::model::http_route::HeaderModifier>,
        {
            self.request_header_modifier = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [request_header_modifier][crate::model::http_route::Destination::request_header_modifier].
        pub fn set_or_clear_request_header_modifier<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<crate::model::http_route::HeaderModifier>,
        {
            self.request_header_modifier = v.map(|x| x.into());
            self
        }

        /// Sets the value of [response_header_modifier][crate::model::http_route::Destination::response_header_modifier].
        pub fn set_response_header_modifier<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<crate::model::http_route::HeaderModifier>,
        {
            self.response_header_modifier = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [response_header_modifier][crate::model::http_route::Destination::response_header_modifier].
        pub fn set_or_clear_response_header_modifier<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<crate::model::http_route::HeaderModifier>,
        {
            self.response_header_modifier = v.map(|x| x.into());
            self
        }
    }

    impl wkt::message::Message for Destination {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.networkservices.v1.HttpRoute.Destination"
        }
    }

    /// The specification for redirecting traffic.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct Redirect {
        /// The host that will be used in the redirect response instead of the one
        /// that was supplied in the request.
        pub host_redirect: std::string::String,

        /// The path that will be used in the redirect response instead of the one
        /// that was supplied in the request.
        /// path_redirect can not be supplied together with prefix_redirect. Supply
        /// one alone or neither. If neither is supplied, the path of the original
        /// request will be used for the redirect.
        pub path_redirect: std::string::String,

        /// Indicates that during redirection, the matched prefix (or path) should be
        /// swapped with this value. This option allows URLs be dynamically created
        /// based on the request.
        pub prefix_rewrite: std::string::String,

        /// The HTTP Status code to use for the redirect.
        pub response_code: crate::model::http_route::redirect::ResponseCode,

        /// If set to true, the URL scheme in the redirected request is set to https.
        /// If set to false, the URL scheme of the redirected request will remain the
        /// same as that of the request.
        ///
        /// The default is set to false.
        pub https_redirect: bool,

        /// if set to true, any accompanying query portion of the original URL is
        /// removed prior to redirecting the request. If set to false, the query
        /// portion of the original URL is retained.
        ///
        /// The default is set to false.
        pub strip_query: bool,

        /// The port that will be used in the redirected request instead of the one
        /// that was supplied in the request.
        pub port_redirect: i32,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl Redirect {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [host_redirect][crate::model::http_route::Redirect::host_redirect].
        pub fn set_host_redirect<T: std::convert::Into<std::string::String>>(
            mut self,
            v: T,
        ) -> Self {
            self.host_redirect = v.into();
            self
        }

        /// Sets the value of [path_redirect][crate::model::http_route::Redirect::path_redirect].
        pub fn set_path_redirect<T: std::convert::Into<std::string::String>>(
            mut self,
            v: T,
        ) -> Self {
            self.path_redirect = v.into();
            self
        }

        /// Sets the value of [prefix_rewrite][crate::model::http_route::Redirect::prefix_rewrite].
        pub fn set_prefix_rewrite<T: std::convert::Into<std::string::String>>(
            mut self,
            v: T,
        ) -> Self {
            self.prefix_rewrite = v.into();
            self
        }

        /// Sets the value of [response_code][crate::model::http_route::Redirect::response_code].
        pub fn set_response_code<
            T: std::convert::Into<crate::model::http_route::redirect::ResponseCode>,
        >(
            mut self,
            v: T,
        ) -> Self {
            self.response_code = v.into();
            self
        }

        /// Sets the value of [https_redirect][crate::model::http_route::Redirect::https_redirect].
        pub fn set_https_redirect<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
            self.https_redirect = v.into();
            self
        }

        /// Sets the value of [strip_query][crate::model::http_route::Redirect::strip_query].
        pub fn set_strip_query<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
            self.strip_query = v.into();
            self
        }

        /// Sets the value of [port_redirect][crate::model::http_route::Redirect::port_redirect].
        pub fn set_port_redirect<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
            self.port_redirect = v.into();
            self
        }
    }

    impl wkt::message::Message for Redirect {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.networkservices.v1.HttpRoute.Redirect"
        }
    }

    /// Defines additional types related to [Redirect].
    pub mod redirect {
        #[allow(unused_imports)]
        use super::*;

        /// Supported HTTP response code.
        ///
        /// # Working with unknown values
        ///
        /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
        /// additional enum variants at any time. Adding new variants is not considered
        /// a breaking change. Applications should write their code in anticipation of:
        ///
        /// - New values appearing in future releases of the client library, **and**
        /// - New values received dynamically, without application changes.
        ///
        /// Please consult the [Working with enums] section in the user guide for some
        /// guidelines.
        ///
        /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
        #[derive(Clone, Debug, PartialEq)]
        #[non_exhaustive]
        pub enum ResponseCode {
            /// Default value
            Unspecified,
            /// Corresponds to 301.
            MovedPermanentlyDefault,
            /// Corresponds to 302.
            Found,
            /// Corresponds to 303.
            SeeOther,
            /// Corresponds to 307. In this case, the request method will be retained.
            TemporaryRedirect,
            /// Corresponds to 308. In this case, the request method will be retained.
            PermanentRedirect,
            /// If set, the enum was initialized with an unknown value.
            ///
            /// Applications can examine the value using [ResponseCode::value] or
            /// [ResponseCode::name].
            UnknownValue(response_code::UnknownValue),
        }

        #[doc(hidden)]
        pub mod response_code {
            #[allow(unused_imports)]
            use super::*;
            #[derive(Clone, Debug, PartialEq)]
            pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
        }

        impl ResponseCode {
            /// Gets the enum value.
            ///
            /// Returns `None` if the enum contains an unknown value deserialized from
            /// the string representation of enums.
            pub fn value(&self) -> std::option::Option<i32> {
                match self {
                    Self::Unspecified => std::option::Option::Some(0),
                    Self::MovedPermanentlyDefault => std::option::Option::Some(1),
                    Self::Found => std::option::Option::Some(2),
                    Self::SeeOther => std::option::Option::Some(3),
                    Self::TemporaryRedirect => std::option::Option::Some(4),
                    Self::PermanentRedirect => std::option::Option::Some(5),
                    Self::UnknownValue(u) => u.0.value(),
                }
            }

            /// Gets the enum value as a string.
            ///
            /// Returns `None` if the enum contains an unknown value deserialized from
            /// the integer representation of enums.
            pub fn name(&self) -> std::option::Option<&str> {
                match self {
                    Self::Unspecified => std::option::Option::Some("RESPONSE_CODE_UNSPECIFIED"),
                    Self::MovedPermanentlyDefault => {
                        std::option::Option::Some("MOVED_PERMANENTLY_DEFAULT")
                    }
                    Self::Found => std::option::Option::Some("FOUND"),
                    Self::SeeOther => std::option::Option::Some("SEE_OTHER"),
                    Self::TemporaryRedirect => std::option::Option::Some("TEMPORARY_REDIRECT"),
                    Self::PermanentRedirect => std::option::Option::Some("PERMANENT_REDIRECT"),
                    Self::UnknownValue(u) => u.0.name(),
                }
            }
        }

        impl std::default::Default for ResponseCode {
            fn default() -> Self {
                use std::convert::From;
                Self::from(0)
            }
        }

        impl std::fmt::Display for ResponseCode {
            fn fmt(
                &self,
                f: &mut std::fmt::Formatter<'_>,
            ) -> std::result::Result<(), std::fmt::Error> {
                wkt::internal::display_enum(f, self.name(), self.value())
            }
        }

        impl std::convert::From<i32> for ResponseCode {
            fn from(value: i32) -> Self {
                match value {
                    0 => Self::Unspecified,
                    1 => Self::MovedPermanentlyDefault,
                    2 => Self::Found,
                    3 => Self::SeeOther,
                    4 => Self::TemporaryRedirect,
                    5 => Self::PermanentRedirect,
                    _ => Self::UnknownValue(response_code::UnknownValue(
                        wkt::internal::UnknownEnumValue::Integer(value),
                    )),
                }
            }
        }

        impl std::convert::From<&str> for ResponseCode {
            fn from(value: &str) -> Self {
                use std::string::ToString;
                match value {
                    "RESPONSE_CODE_UNSPECIFIED" => Self::Unspecified,
                    "MOVED_PERMANENTLY_DEFAULT" => Self::MovedPermanentlyDefault,
                    "FOUND" => Self::Found,
                    "SEE_OTHER" => Self::SeeOther,
                    "TEMPORARY_REDIRECT" => Self::TemporaryRedirect,
                    "PERMANENT_REDIRECT" => Self::PermanentRedirect,
                    _ => Self::UnknownValue(response_code::UnknownValue(
                        wkt::internal::UnknownEnumValue::String(value.to_string()),
                    )),
                }
            }
        }

        impl serde::ser::Serialize for ResponseCode {
            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
            where
                S: serde::Serializer,
            {
                match self {
                    Self::Unspecified => serializer.serialize_i32(0),
                    Self::MovedPermanentlyDefault => serializer.serialize_i32(1),
                    Self::Found => serializer.serialize_i32(2),
                    Self::SeeOther => serializer.serialize_i32(3),
                    Self::TemporaryRedirect => serializer.serialize_i32(4),
                    Self::PermanentRedirect => serializer.serialize_i32(5),
                    Self::UnknownValue(u) => u.0.serialize(serializer),
                }
            }
        }

        impl<'de> serde::de::Deserialize<'de> for ResponseCode {
            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                deserializer.deserialize_any(wkt::internal::EnumVisitor::<ResponseCode>::new(
                    ".google.cloud.networkservices.v1.HttpRoute.Redirect.ResponseCode",
                ))
            }
        }
    }

    /// The specification for fault injection introduced into traffic to test the
    /// resiliency of clients to destination service failure. As part of fault
    /// injection, when clients send requests to a destination, delays can be
    /// introduced by client proxy on a percentage of requests before sending those
    /// requests to the destination service. Similarly requests can be aborted by
    /// client proxy for a percentage of requests.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct FaultInjectionPolicy {
        /// The specification for injecting delay to client requests.
        pub delay: std::option::Option<crate::model::http_route::fault_injection_policy::Delay>,

        /// The specification for aborting to client requests.
        pub abort: std::option::Option<crate::model::http_route::fault_injection_policy::Abort>,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl FaultInjectionPolicy {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [delay][crate::model::http_route::FaultInjectionPolicy::delay].
        pub fn set_delay<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<crate::model::http_route::fault_injection_policy::Delay>,
        {
            self.delay = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [delay][crate::model::http_route::FaultInjectionPolicy::delay].
        pub fn set_or_clear_delay<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<crate::model::http_route::fault_injection_policy::Delay>,
        {
            self.delay = v.map(|x| x.into());
            self
        }

        /// Sets the value of [abort][crate::model::http_route::FaultInjectionPolicy::abort].
        pub fn set_abort<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<crate::model::http_route::fault_injection_policy::Abort>,
        {
            self.abort = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [abort][crate::model::http_route::FaultInjectionPolicy::abort].
        pub fn set_or_clear_abort<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<crate::model::http_route::fault_injection_policy::Abort>,
        {
            self.abort = v.map(|x| x.into());
            self
        }
    }

    impl wkt::message::Message for FaultInjectionPolicy {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.networkservices.v1.HttpRoute.FaultInjectionPolicy"
        }
    }

    /// Defines additional types related to [FaultInjectionPolicy].
    pub mod fault_injection_policy {
        #[allow(unused_imports)]
        use super::*;

        /// Specification of how client requests are delayed as part of fault
        /// injection before being sent to a destination.
        #[derive(Clone, Default, PartialEq)]
        #[non_exhaustive]
        pub struct Delay {
            /// Specify a fixed delay before forwarding the request.
            pub fixed_delay: std::option::Option<wkt::Duration>,

            /// The percentage of traffic on which delay will be injected.
            ///
            /// The value must be between [0, 100]
            pub percentage: i32,

            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
        }

        impl Delay {
            pub fn new() -> Self {
                std::default::Default::default()
            }

            /// Sets the value of [fixed_delay][crate::model::http_route::fault_injection_policy::Delay::fixed_delay].
            pub fn set_fixed_delay<T>(mut self, v: T) -> Self
            where
                T: std::convert::Into<wkt::Duration>,
            {
                self.fixed_delay = std::option::Option::Some(v.into());
                self
            }

            /// Sets or clears the value of [fixed_delay][crate::model::http_route::fault_injection_policy::Delay::fixed_delay].
            pub fn set_or_clear_fixed_delay<T>(mut self, v: std::option::Option<T>) -> Self
            where
                T: std::convert::Into<wkt::Duration>,
            {
                self.fixed_delay = v.map(|x| x.into());
                self
            }

            /// Sets the value of [percentage][crate::model::http_route::fault_injection_policy::Delay::percentage].
            pub fn set_percentage<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
                self.percentage = v.into();
                self
            }
        }

        impl wkt::message::Message for Delay {
            fn typename() -> &'static str {
                "type.googleapis.com/google.cloud.networkservices.v1.HttpRoute.FaultInjectionPolicy.Delay"
            }
        }

        /// Specification of how client requests are aborted as part of fault
        /// injection before being sent to a destination.
        #[derive(Clone, Default, PartialEq)]
        #[non_exhaustive]
        pub struct Abort {
            /// The HTTP status code used to abort the request.
            ///
            /// The value must be between 200 and 599 inclusive.
            pub http_status: i32,

            /// The percentage of traffic which will be aborted.
            ///
            /// The value must be between [0, 100]
            pub percentage: i32,

            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
        }

        impl Abort {
            pub fn new() -> Self {
                std::default::Default::default()
            }

            /// Sets the value of [http_status][crate::model::http_route::fault_injection_policy::Abort::http_status].
            pub fn set_http_status<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
                self.http_status = v.into();
                self
            }

            /// Sets the value of [percentage][crate::model::http_route::fault_injection_policy::Abort::percentage].
            pub fn set_percentage<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
                self.percentage = v.into();
                self
            }
        }

        impl wkt::message::Message for Abort {
            fn typename() -> &'static str {
                "type.googleapis.com/google.cloud.networkservices.v1.HttpRoute.FaultInjectionPolicy.Abort"
            }
        }
    }

    /// The specification for cookie-based stateful session affinity where the
    /// date plane supplies a “session cookie”  with the name "GSSA" which encodes
    /// a specific destination host and each request containing that cookie will
    /// be directed to that host as long as the destination host remains up and
    /// healthy.
    ///
    /// The gRPC proxyless mesh library or sidecar proxy will manage the session
    /// cookie but the client application code is responsible for copying the
    /// cookie from each RPC in the session to the next.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct StatefulSessionAffinityPolicy {
        /// Required. The cookie TTL value for the Set-Cookie header generated by
        /// the data plane. The lifetime of the cookie may be set to a value from 0
        /// to 86400 seconds (24 hours) inclusive.
        ///
        /// Set this to 0s to use a session cookie and disable cookie expiration.
        pub cookie_ttl: std::option::Option<wkt::Duration>,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl StatefulSessionAffinityPolicy {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [cookie_ttl][crate::model::http_route::StatefulSessionAffinityPolicy::cookie_ttl].
        pub fn set_cookie_ttl<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<wkt::Duration>,
        {
            self.cookie_ttl = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [cookie_ttl][crate::model::http_route::StatefulSessionAffinityPolicy::cookie_ttl].
        pub fn set_or_clear_cookie_ttl<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<wkt::Duration>,
        {
            self.cookie_ttl = v.map(|x| x.into());
            self
        }
    }

    impl wkt::message::Message for StatefulSessionAffinityPolicy {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.networkservices.v1.HttpRoute.StatefulSessionAffinityPolicy"
        }
    }

    /// The specification for modifying HTTP header in HTTP request and HTTP
    /// response.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct HeaderModifier {
        /// Completely overwrite/replace the headers with given map where key is the
        /// name of the header, value is the value of the header.
        pub set: std::collections::HashMap<std::string::String, std::string::String>,

        /// Add the headers with given map where key is the name of the header, value
        /// is the value of the header.
        pub add: std::collections::HashMap<std::string::String, std::string::String>,

        /// Remove headers (matching by header names) specified in the list.
        pub remove: std::vec::Vec<std::string::String>,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl HeaderModifier {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [set][crate::model::http_route::HeaderModifier::set].
        pub fn set_set<T, K, V>(mut self, v: T) -> Self
        where
            T: std::iter::IntoIterator<Item = (K, V)>,
            K: std::convert::Into<std::string::String>,
            V: std::convert::Into<std::string::String>,
        {
            use std::iter::Iterator;
            self.set = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
            self
        }

        /// Sets the value of [add][crate::model::http_route::HeaderModifier::add].
        pub fn set_add<T, K, V>(mut self, v: T) -> Self
        where
            T: std::iter::IntoIterator<Item = (K, V)>,
            K: std::convert::Into<std::string::String>,
            V: std::convert::Into<std::string::String>,
        {
            use std::iter::Iterator;
            self.add = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
            self
        }

        /// Sets the value of [remove][crate::model::http_route::HeaderModifier::remove].
        pub fn set_remove<T, V>(mut self, v: T) -> Self
        where
            T: std::iter::IntoIterator<Item = V>,
            V: std::convert::Into<std::string::String>,
        {
            use std::iter::Iterator;
            self.remove = v.into_iter().map(|i| i.into()).collect();
            self
        }
    }

    impl wkt::message::Message for HeaderModifier {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.networkservices.v1.HttpRoute.HeaderModifier"
        }
    }

    /// The specification for modifying the URL of the request, prior to forwarding
    /// the request to the destination.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct URLRewrite {
        /// Prior to forwarding the request to the selected destination, the matching
        /// portion of the requests path is replaced by this value.
        pub path_prefix_rewrite: std::string::String,

        /// Prior to forwarding the request to the selected destination, the requests
        /// host header is replaced by this value.
        pub host_rewrite: std::string::String,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl URLRewrite {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [path_prefix_rewrite][crate::model::http_route::URLRewrite::path_prefix_rewrite].
        pub fn set_path_prefix_rewrite<T: std::convert::Into<std::string::String>>(
            mut self,
            v: T,
        ) -> Self {
            self.path_prefix_rewrite = v.into();
            self
        }

        /// Sets the value of [host_rewrite][crate::model::http_route::URLRewrite::host_rewrite].
        pub fn set_host_rewrite<T: std::convert::Into<std::string::String>>(
            mut self,
            v: T,
        ) -> Self {
            self.host_rewrite = v.into();
            self
        }
    }

    impl wkt::message::Message for URLRewrite {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.networkservices.v1.HttpRoute.URLRewrite"
        }
    }

    /// The specifications for retries.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct RetryPolicy {
        /// Specifies one or more conditions when this retry policy applies. Valid
        /// values are:
        /// 5xx: Proxy will attempt a retry if the destination service responds
        /// with any 5xx response code, of if the destination service does not
        /// respond at all, example: disconnect, reset, read timeout, connection
        /// failure and refused streams.
        ///
        /// gateway-error: Similar to 5xx, but only applies to response codes 502,
        /// 503, 504.
        ///
        /// reset: Proxy will attempt a retry if the destination service does not
        /// respond at all (disconnect/reset/read timeout)
        ///
        /// connect-failure: Proxy will retry on failures connecting to destination
        /// for example due to connection timeouts.
        ///
        /// retriable-4xx: Proxy will retry fro retriable 4xx response codes.
        /// Currently the only retriable error supported is 409.
        ///
        /// refused-stream: Proxy will retry if the destination resets the stream
        /// with a REFUSED_STREAM error code. This reset type indicates that it
        /// is safe to retry.
        pub retry_conditions: std::vec::Vec<std::string::String>,

        /// Specifies the allowed number of retries. This number must be > 0. If not
        /// specified, default to 1.
        pub num_retries: i32,

        /// Specifies a non-zero timeout per retry attempt.
        pub per_try_timeout: std::option::Option<wkt::Duration>,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl RetryPolicy {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [retry_conditions][crate::model::http_route::RetryPolicy::retry_conditions].
        pub fn set_retry_conditions<T, V>(mut self, v: T) -> Self
        where
            T: std::iter::IntoIterator<Item = V>,
            V: std::convert::Into<std::string::String>,
        {
            use std::iter::Iterator;
            self.retry_conditions = v.into_iter().map(|i| i.into()).collect();
            self
        }

        /// Sets the value of [num_retries][crate::model::http_route::RetryPolicy::num_retries].
        pub fn set_num_retries<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
            self.num_retries = v.into();
            self
        }

        /// Sets the value of [per_try_timeout][crate::model::http_route::RetryPolicy::per_try_timeout].
        pub fn set_per_try_timeout<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<wkt::Duration>,
        {
            self.per_try_timeout = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [per_try_timeout][crate::model::http_route::RetryPolicy::per_try_timeout].
        pub fn set_or_clear_per_try_timeout<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<wkt::Duration>,
        {
            self.per_try_timeout = v.map(|x| x.into());
            self
        }
    }

    impl wkt::message::Message for RetryPolicy {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.networkservices.v1.HttpRoute.RetryPolicy"
        }
    }

    /// Specifies the policy on how requests are shadowed to a separate mirrored
    /// destination service. The proxy does not wait for responses from the
    /// shadow service. Prior to sending traffic to the shadow service, the
    /// host/authority header is suffixed with -shadow.
    /// Mirroring is currently not supported for Cloud Run destinations.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct RequestMirrorPolicy {
        /// The destination the requests will be mirrored to. The weight of the
        /// destination will be ignored.
        pub destination: std::option::Option<crate::model::http_route::Destination>,

        /// Optional. The percentage of requests to get mirrored to the desired
        /// destination.
        pub mirror_percent: f32,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl RequestMirrorPolicy {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [destination][crate::model::http_route::RequestMirrorPolicy::destination].
        pub fn set_destination<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<crate::model::http_route::Destination>,
        {
            self.destination = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [destination][crate::model::http_route::RequestMirrorPolicy::destination].
        pub fn set_or_clear_destination<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<crate::model::http_route::Destination>,
        {
            self.destination = v.map(|x| x.into());
            self
        }

        /// Sets the value of [mirror_percent][crate::model::http_route::RequestMirrorPolicy::mirror_percent].
        pub fn set_mirror_percent<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
            self.mirror_percent = v.into();
            self
        }
    }

    impl wkt::message::Message for RequestMirrorPolicy {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.networkservices.v1.HttpRoute.RequestMirrorPolicy"
        }
    }

    /// The Specification for allowing client side cross-origin requests.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct CorsPolicy {
        /// Specifies the list of origins that will be allowed to do CORS requests.
        /// An origin is allowed if it matches either an item in allow_origins or
        /// an item in allow_origin_regexes.
        pub allow_origins: std::vec::Vec<std::string::String>,

        /// Specifies the regular expression patterns that match allowed origins. For
        /// regular expression grammar, please see
        /// <https://github.com/google/re2/wiki/Syntax>.
        pub allow_origin_regexes: std::vec::Vec<std::string::String>,

        /// Specifies the content for Access-Control-Allow-Methods header.
        pub allow_methods: std::vec::Vec<std::string::String>,

        /// Specifies the content for Access-Control-Allow-Headers header.
        pub allow_headers: std::vec::Vec<std::string::String>,

        /// Specifies the content for Access-Control-Expose-Headers header.
        pub expose_headers: std::vec::Vec<std::string::String>,

        /// Specifies how long result of a preflight request can be cached in
        /// seconds. This translates to the Access-Control-Max-Age header.
        pub max_age: std::string::String,

        /// In response to a preflight request, setting this to true indicates that
        /// the actual request can include user credentials. This translates to the
        /// Access-Control-Allow-Credentials header.
        ///
        /// Default value is false.
        pub allow_credentials: bool,

        /// If true, the CORS policy is disabled. The default value is false, which
        /// indicates that the CORS policy is in effect.
        pub disabled: bool,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl CorsPolicy {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [allow_origins][crate::model::http_route::CorsPolicy::allow_origins].
        pub fn set_allow_origins<T, V>(mut self, v: T) -> Self
        where
            T: std::iter::IntoIterator<Item = V>,
            V: std::convert::Into<std::string::String>,
        {
            use std::iter::Iterator;
            self.allow_origins = v.into_iter().map(|i| i.into()).collect();
            self
        }

        /// Sets the value of [allow_origin_regexes][crate::model::http_route::CorsPolicy::allow_origin_regexes].
        pub fn set_allow_origin_regexes<T, V>(mut self, v: T) -> Self
        where
            T: std::iter::IntoIterator<Item = V>,
            V: std::convert::Into<std::string::String>,
        {
            use std::iter::Iterator;
            self.allow_origin_regexes = v.into_iter().map(|i| i.into()).collect();
            self
        }

        /// Sets the value of [allow_methods][crate::model::http_route::CorsPolicy::allow_methods].
        pub fn set_allow_methods<T, V>(mut self, v: T) -> Self
        where
            T: std::iter::IntoIterator<Item = V>,
            V: std::convert::Into<std::string::String>,
        {
            use std::iter::Iterator;
            self.allow_methods = v.into_iter().map(|i| i.into()).collect();
            self
        }

        /// Sets the value of [allow_headers][crate::model::http_route::CorsPolicy::allow_headers].
        pub fn set_allow_headers<T, V>(mut self, v: T) -> Self
        where
            T: std::iter::IntoIterator<Item = V>,
            V: std::convert::Into<std::string::String>,
        {
            use std::iter::Iterator;
            self.allow_headers = v.into_iter().map(|i| i.into()).collect();
            self
        }

        /// Sets the value of [expose_headers][crate::model::http_route::CorsPolicy::expose_headers].
        pub fn set_expose_headers<T, V>(mut self, v: T) -> Self
        where
            T: std::iter::IntoIterator<Item = V>,
            V: std::convert::Into<std::string::String>,
        {
            use std::iter::Iterator;
            self.expose_headers = v.into_iter().map(|i| i.into()).collect();
            self
        }

        /// Sets the value of [max_age][crate::model::http_route::CorsPolicy::max_age].
        pub fn set_max_age<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
            self.max_age = v.into();
            self
        }

        /// Sets the value of [allow_credentials][crate::model::http_route::CorsPolicy::allow_credentials].
        pub fn set_allow_credentials<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
            self.allow_credentials = v.into();
            self
        }

        /// Sets the value of [disabled][crate::model::http_route::CorsPolicy::disabled].
        pub fn set_disabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
            self.disabled = v.into();
            self
        }
    }

    impl wkt::message::Message for CorsPolicy {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.networkservices.v1.HttpRoute.CorsPolicy"
        }
    }

    /// Static HTTP response object to be returned.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct HttpDirectResponse {
        /// Required. Status to return as part of HTTP Response. Must be a positive
        /// integer.
        pub status: i32,

        /// Body to return as part of HTTP Response.
        pub http_body:
            std::option::Option<crate::model::http_route::http_direct_response::HttpBody>,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl HttpDirectResponse {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [status][crate::model::http_route::HttpDirectResponse::status].
        pub fn set_status<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
            self.status = v.into();
            self
        }

        /// Sets the value of [http_body][crate::model::http_route::HttpDirectResponse::http_body].
        ///
        /// Note that all the setters affecting `http_body` are mutually
        /// exclusive.
        pub fn set_http_body<
            T: std::convert::Into<
                    std::option::Option<crate::model::http_route::http_direct_response::HttpBody>,
                >,
        >(
            mut self,
            v: T,
        ) -> Self {
            self.http_body = v.into();
            self
        }

        /// The value of [http_body][crate::model::http_route::HttpDirectResponse::http_body]
        /// if it holds a `StringBody`, `None` if the field is not set or
        /// holds a different branch.
        pub fn string_body(&self) -> std::option::Option<&std::string::String> {
            #[allow(unreachable_patterns)]
            self.http_body.as_ref().and_then(|v| match v {
                crate::model::http_route::http_direct_response::HttpBody::StringBody(v) => {
                    std::option::Option::Some(v)
                }
                _ => std::option::Option::None,
            })
        }

        /// Sets the value of [http_body][crate::model::http_route::HttpDirectResponse::http_body]
        /// to hold a `StringBody`.
        ///
        /// Note that all the setters affecting `http_body` are
        /// mutually exclusive.
        pub fn set_string_body<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
            self.http_body = std::option::Option::Some(
                crate::model::http_route::http_direct_response::HttpBody::StringBody(v.into()),
            );
            self
        }

        /// The value of [http_body][crate::model::http_route::HttpDirectResponse::http_body]
        /// if it holds a `BytesBody`, `None` if the field is not set or
        /// holds a different branch.
        pub fn bytes_body(&self) -> std::option::Option<&::bytes::Bytes> {
            #[allow(unreachable_patterns)]
            self.http_body.as_ref().and_then(|v| match v {
                crate::model::http_route::http_direct_response::HttpBody::BytesBody(v) => {
                    std::option::Option::Some(v)
                }
                _ => std::option::Option::None,
            })
        }

        /// Sets the value of [http_body][crate::model::http_route::HttpDirectResponse::http_body]
        /// to hold a `BytesBody`.
        ///
        /// Note that all the setters affecting `http_body` are
        /// mutually exclusive.
        pub fn set_bytes_body<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
            self.http_body = std::option::Option::Some(
                crate::model::http_route::http_direct_response::HttpBody::BytesBody(v.into()),
            );
            self
        }
    }

    impl wkt::message::Message for HttpDirectResponse {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.networkservices.v1.HttpRoute.HttpDirectResponse"
        }
    }

    /// Defines additional types related to [HttpDirectResponse].
    pub mod http_direct_response {
        #[allow(unused_imports)]
        use super::*;

        /// Body to return as part of HTTP Response.
        #[derive(Clone, Debug, PartialEq)]
        #[non_exhaustive]
        pub enum HttpBody {
            /// Optional. Response body as a string. Maximum body length is 1024
            /// characters.
            StringBody(std::string::String),
            /// Optional. Response body as bytes. Maximum body size is 4096B.
            BytesBody(::bytes::Bytes),
        }
    }

    /// The specifications for routing traffic and applying associated policies.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct RouteAction {
        /// The destination to which traffic should be forwarded.
        pub destinations: std::vec::Vec<crate::model::http_route::Destination>,

        /// If set, the request is directed as configured by this field.
        pub redirect: std::option::Option<crate::model::http_route::Redirect>,

        /// The specification for fault injection introduced into traffic to test the
        /// resiliency of clients to backend service failure. As part of fault
        /// injection, when clients send requests to a backend service, delays can be
        /// introduced  on a percentage of requests before sending those requests to
        /// the backend service. Similarly requests from clients can be aborted for a
        /// percentage of requests.
        ///
        /// timeout and retry_policy will be ignored by clients that are configured
        /// with a fault_injection_policy
        pub fault_injection_policy:
            std::option::Option<crate::model::http_route::FaultInjectionPolicy>,

        /// The specification for modifying the headers of a matching request prior
        /// to delivery of the request to the destination. If HeaderModifiers are set
        /// on both the Destination and the RouteAction, they will be merged.
        /// Conflicts between the two will not be resolved on the configuration.
        pub request_header_modifier: std::option::Option<crate::model::http_route::HeaderModifier>,

        /// The specification for modifying the headers of a response prior to
        /// sending the response back to the client. If HeaderModifiers are set
        /// on both the Destination and the RouteAction, they will be merged.
        /// Conflicts between the two will not be resolved on the configuration.
        pub response_header_modifier: std::option::Option<crate::model::http_route::HeaderModifier>,

        /// The specification for rewrite URL before forwarding requests to the
        /// destination.
        pub url_rewrite: std::option::Option<crate::model::http_route::URLRewrite>,

        /// Specifies the timeout for selected route. Timeout is computed from the
        /// time the request has been fully processed (i.e. end of stream) up until
        /// the response has been completely processed. Timeout includes all retries.
        pub timeout: std::option::Option<wkt::Duration>,

        /// Specifies the retry policy associated with this route.
        pub retry_policy: std::option::Option<crate::model::http_route::RetryPolicy>,

        /// Specifies the policy on how requests intended for the routes destination
        /// are shadowed to a separate mirrored destination. Proxy will not wait for
        /// the shadow destination to respond before returning the response. Prior to
        /// sending traffic to the shadow service, the host/authority header is
        /// suffixed with -shadow.
        pub request_mirror_policy:
            std::option::Option<crate::model::http_route::RequestMirrorPolicy>,

        /// The specification for allowing client side cross-origin requests.
        pub cors_policy: std::option::Option<crate::model::http_route::CorsPolicy>,

        /// Optional. Specifies cookie-based stateful session affinity.
        pub stateful_session_affinity:
            std::option::Option<crate::model::http_route::StatefulSessionAffinityPolicy>,

        /// Optional. Static HTTP Response object to be returned regardless of the
        /// request.
        pub direct_response: std::option::Option<crate::model::http_route::HttpDirectResponse>,

        /// Optional. Specifies the idle timeout for the selected route. The idle
        /// timeout is defined as the period in which there are no bytes sent or
        /// received on either the upstream or downstream connection. If not set, the
        /// default idle timeout is 1 hour. If set to 0s, the timeout will be
        /// disabled.
        pub idle_timeout: std::option::Option<wkt::Duration>,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl RouteAction {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [destinations][crate::model::http_route::RouteAction::destinations].
        pub fn set_destinations<T, V>(mut self, v: T) -> Self
        where
            T: std::iter::IntoIterator<Item = V>,
            V: std::convert::Into<crate::model::http_route::Destination>,
        {
            use std::iter::Iterator;
            self.destinations = v.into_iter().map(|i| i.into()).collect();
            self
        }

        /// Sets the value of [redirect][crate::model::http_route::RouteAction::redirect].
        pub fn set_redirect<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<crate::model::http_route::Redirect>,
        {
            self.redirect = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [redirect][crate::model::http_route::RouteAction::redirect].
        pub fn set_or_clear_redirect<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<crate::model::http_route::Redirect>,
        {
            self.redirect = v.map(|x| x.into());
            self
        }

        /// Sets the value of [fault_injection_policy][crate::model::http_route::RouteAction::fault_injection_policy].
        pub fn set_fault_injection_policy<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<crate::model::http_route::FaultInjectionPolicy>,
        {
            self.fault_injection_policy = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [fault_injection_policy][crate::model::http_route::RouteAction::fault_injection_policy].
        pub fn set_or_clear_fault_injection_policy<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<crate::model::http_route::FaultInjectionPolicy>,
        {
            self.fault_injection_policy = v.map(|x| x.into());
            self
        }

        /// Sets the value of [request_header_modifier][crate::model::http_route::RouteAction::request_header_modifier].
        pub fn set_request_header_modifier<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<crate::model::http_route::HeaderModifier>,
        {
            self.request_header_modifier = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [request_header_modifier][crate::model::http_route::RouteAction::request_header_modifier].
        pub fn set_or_clear_request_header_modifier<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<crate::model::http_route::HeaderModifier>,
        {
            self.request_header_modifier = v.map(|x| x.into());
            self
        }

        /// Sets the value of [response_header_modifier][crate::model::http_route::RouteAction::response_header_modifier].
        pub fn set_response_header_modifier<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<crate::model::http_route::HeaderModifier>,
        {
            self.response_header_modifier = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [response_header_modifier][crate::model::http_route::RouteAction::response_header_modifier].
        pub fn set_or_clear_response_header_modifier<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<crate::model::http_route::HeaderModifier>,
        {
            self.response_header_modifier = v.map(|x| x.into());
            self
        }

        /// Sets the value of [url_rewrite][crate::model::http_route::RouteAction::url_rewrite].
        pub fn set_url_rewrite<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<crate::model::http_route::URLRewrite>,
        {
            self.url_rewrite = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [url_rewrite][crate::model::http_route::RouteAction::url_rewrite].
        pub fn set_or_clear_url_rewrite<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<crate::model::http_route::URLRewrite>,
        {
            self.url_rewrite = v.map(|x| x.into());
            self
        }

        /// Sets the value of [timeout][crate::model::http_route::RouteAction::timeout].
        pub fn set_timeout<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<wkt::Duration>,
        {
            self.timeout = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [timeout][crate::model::http_route::RouteAction::timeout].
        pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<wkt::Duration>,
        {
            self.timeout = v.map(|x| x.into());
            self
        }

        /// Sets the value of [retry_policy][crate::model::http_route::RouteAction::retry_policy].
        pub fn set_retry_policy<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<crate::model::http_route::RetryPolicy>,
        {
            self.retry_policy = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [retry_policy][crate::model::http_route::RouteAction::retry_policy].
        pub fn set_or_clear_retry_policy<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<crate::model::http_route::RetryPolicy>,
        {
            self.retry_policy = v.map(|x| x.into());
            self
        }

        /// Sets the value of [request_mirror_policy][crate::model::http_route::RouteAction::request_mirror_policy].
        pub fn set_request_mirror_policy<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<crate::model::http_route::RequestMirrorPolicy>,
        {
            self.request_mirror_policy = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [request_mirror_policy][crate::model::http_route::RouteAction::request_mirror_policy].
        pub fn set_or_clear_request_mirror_policy<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<crate::model::http_route::RequestMirrorPolicy>,
        {
            self.request_mirror_policy = v.map(|x| x.into());
            self
        }

        /// Sets the value of [cors_policy][crate::model::http_route::RouteAction::cors_policy].
        pub fn set_cors_policy<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<crate::model::http_route::CorsPolicy>,
        {
            self.cors_policy = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [cors_policy][crate::model::http_route::RouteAction::cors_policy].
        pub fn set_or_clear_cors_policy<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<crate::model::http_route::CorsPolicy>,
        {
            self.cors_policy = v.map(|x| x.into());
            self
        }

        /// Sets the value of [stateful_session_affinity][crate::model::http_route::RouteAction::stateful_session_affinity].
        pub fn set_stateful_session_affinity<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<crate::model::http_route::StatefulSessionAffinityPolicy>,
        {
            self.stateful_session_affinity = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [stateful_session_affinity][crate::model::http_route::RouteAction::stateful_session_affinity].
        pub fn set_or_clear_stateful_session_affinity<T>(
            mut self,
            v: std::option::Option<T>,
        ) -> Self
        where
            T: std::convert::Into<crate::model::http_route::StatefulSessionAffinityPolicy>,
        {
            self.stateful_session_affinity = v.map(|x| x.into());
            self
        }

        /// Sets the value of [direct_response][crate::model::http_route::RouteAction::direct_response].
        pub fn set_direct_response<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<crate::model::http_route::HttpDirectResponse>,
        {
            self.direct_response = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [direct_response][crate::model::http_route::RouteAction::direct_response].
        pub fn set_or_clear_direct_response<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<crate::model::http_route::HttpDirectResponse>,
        {
            self.direct_response = v.map(|x| x.into());
            self
        }

        /// Sets the value of [idle_timeout][crate::model::http_route::RouteAction::idle_timeout].
        pub fn set_idle_timeout<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<wkt::Duration>,
        {
            self.idle_timeout = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [idle_timeout][crate::model::http_route::RouteAction::idle_timeout].
        pub fn set_or_clear_idle_timeout<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<wkt::Duration>,
        {
            self.idle_timeout = v.map(|x| x.into());
            self
        }
    }

    impl wkt::message::Message for RouteAction {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.networkservices.v1.HttpRoute.RouteAction"
        }
    }

    /// Specifies how to match traffic and how to route traffic when traffic is
    /// matched.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct RouteRule {
        /// A list of matches define conditions used for matching the rule against
        /// incoming HTTP requests. Each match is independent, i.e. this rule will be
        /// matched if ANY one of the matches is satisfied.
        ///
        /// If no matches field is specified, this rule will unconditionally match
        /// traffic.
        ///
        /// If a default rule is desired to be configured, add a rule with no matches
        /// specified to the end of the rules list.
        pub matches: std::vec::Vec<crate::model::http_route::RouteMatch>,

        /// The detailed rule defining how to route matched traffic.
        pub action: std::option::Option<crate::model::http_route::RouteAction>,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl RouteRule {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [matches][crate::model::http_route::RouteRule::matches].
        pub fn set_matches<T, V>(mut self, v: T) -> Self
        where
            T: std::iter::IntoIterator<Item = V>,
            V: std::convert::Into<crate::model::http_route::RouteMatch>,
        {
            use std::iter::Iterator;
            self.matches = v.into_iter().map(|i| i.into()).collect();
            self
        }

        /// Sets the value of [action][crate::model::http_route::RouteRule::action].
        pub fn set_action<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<crate::model::http_route::RouteAction>,
        {
            self.action = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [action][crate::model::http_route::RouteRule::action].
        pub fn set_or_clear_action<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<crate::model::http_route::RouteAction>,
        {
            self.action = v.map(|x| x.into());
            self
        }
    }

    impl wkt::message::Message for RouteRule {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.networkservices.v1.HttpRoute.RouteRule"
        }
    }
}

/// Request used with the ListHttpRoutes method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListHttpRoutesRequest {
    /// Required. The project and location from which the HttpRoutes should be
    /// listed, specified in the format `projects/*/locations/global`.
    pub parent: std::string::String,

    /// Maximum number of HttpRoutes to return per call.
    pub page_size: i32,

    /// The value returned by the last `ListHttpRoutesResponse`
    /// Indicates that this is a continuation of a prior `ListHttpRoutes` call,
    /// and that the system should return the next page of data.
    pub page_token: std::string::String,

    /// Optional. If true, allow partial responses for multi-regional Aggregated
    /// List requests. Otherwise if one of the locations is down or unreachable,
    /// the Aggregated List request will fail.
    pub return_partial_success: bool,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListHttpRoutesRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::ListHttpRoutesRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [page_size][crate::model::ListHttpRoutesRequest::page_size].
    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.page_size = v.into();
        self
    }

    /// Sets the value of [page_token][crate::model::ListHttpRoutesRequest::page_token].
    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.page_token = v.into();
        self
    }

    /// Sets the value of [return_partial_success][crate::model::ListHttpRoutesRequest::return_partial_success].
    pub fn set_return_partial_success<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.return_partial_success = v.into();
        self
    }
}

impl wkt::message::Message for ListHttpRoutesRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.ListHttpRoutesRequest"
    }
}

/// Response returned by the ListHttpRoutes method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListHttpRoutesResponse {
    /// List of HttpRoute resources.
    pub http_routes: std::vec::Vec<crate::model::HttpRoute>,

    /// If there might be more results than those appearing in this response, then
    /// `next_page_token` is included. To get the next set of results, call this
    /// method again using the value of `next_page_token` as `page_token`.
    pub next_page_token: std::string::String,

    /// Unreachable resources. Populated when the request opts into
    /// [return_partial_success][google.cloud.networkservices.v1.ListHttpRoutesRequest.return_partial_success]
    /// and reading across collections e.g. when attempting to list all resources
    /// across all supported locations.
    ///
    /// [google.cloud.networkservices.v1.ListHttpRoutesRequest.return_partial_success]: crate::model::ListHttpRoutesRequest::return_partial_success
    pub unreachable: std::vec::Vec<std::string::String>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListHttpRoutesResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [http_routes][crate::model::ListHttpRoutesResponse::http_routes].
    pub fn set_http_routes<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::HttpRoute>,
    {
        use std::iter::Iterator;
        self.http_routes = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [next_page_token][crate::model::ListHttpRoutesResponse::next_page_token].
    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.next_page_token = v.into();
        self
    }

    /// Sets the value of [unreachable][crate::model::ListHttpRoutesResponse::unreachable].
    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.unreachable = v.into_iter().map(|i| i.into()).collect();
        self
    }
}

impl wkt::message::Message for ListHttpRoutesResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.ListHttpRoutesResponse"
    }
}

#[doc(hidden)]
impl gax::paginator::internal::PageableResponse for ListHttpRoutesResponse {
    type PageItem = crate::model::HttpRoute;

    fn items(self) -> std::vec::Vec<Self::PageItem> {
        self.http_routes
    }

    fn next_page_token(&self) -> std::string::String {
        use std::clone::Clone;
        self.next_page_token.clone()
    }
}

/// Request used by the GetHttpRoute method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetHttpRouteRequest {
    /// Required. A name of the HttpRoute to get. Must be in the format
    /// `projects/*/locations/global/httpRoutes/*`.
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GetHttpRouteRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::GetHttpRouteRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for GetHttpRouteRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.GetHttpRouteRequest"
    }
}

/// Request used by the HttpRoute method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateHttpRouteRequest {
    /// Required. The parent resource of the HttpRoute. Must be in the
    /// format `projects/*/locations/global`.
    pub parent: std::string::String,

    /// Required. Short name of the HttpRoute resource to be created.
    pub http_route_id: std::string::String,

    /// Required. HttpRoute resource to be created.
    pub http_route: std::option::Option<crate::model::HttpRoute>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl CreateHttpRouteRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::CreateHttpRouteRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [http_route_id][crate::model::CreateHttpRouteRequest::http_route_id].
    pub fn set_http_route_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.http_route_id = v.into();
        self
    }

    /// Sets the value of [http_route][crate::model::CreateHttpRouteRequest::http_route].
    pub fn set_http_route<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::HttpRoute>,
    {
        self.http_route = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [http_route][crate::model::CreateHttpRouteRequest::http_route].
    pub fn set_or_clear_http_route<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::HttpRoute>,
    {
        self.http_route = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for CreateHttpRouteRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.CreateHttpRouteRequest"
    }
}

/// Request used by the UpdateHttpRoute method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateHttpRouteRequest {
    /// Optional. Field mask is used to specify the fields to be overwritten in the
    /// HttpRoute resource by the update.
    /// The fields specified in the update_mask are relative to the resource, not
    /// the full request. A field will be overwritten if it is in the mask. If the
    /// user does not provide a mask then all fields will be overwritten.
    pub update_mask: std::option::Option<wkt::FieldMask>,

    /// Required. Updated HttpRoute resource.
    pub http_route: std::option::Option<crate::model::HttpRoute>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl UpdateHttpRouteRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [update_mask][crate::model::UpdateHttpRouteRequest::update_mask].
    pub fn set_update_mask<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_mask][crate::model::UpdateHttpRouteRequest::update_mask].
    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = v.map(|x| x.into());
        self
    }

    /// Sets the value of [http_route][crate::model::UpdateHttpRouteRequest::http_route].
    pub fn set_http_route<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::HttpRoute>,
    {
        self.http_route = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [http_route][crate::model::UpdateHttpRouteRequest::http_route].
    pub fn set_or_clear_http_route<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::HttpRoute>,
    {
        self.http_route = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for UpdateHttpRouteRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.UpdateHttpRouteRequest"
    }
}

/// Request used by the DeleteHttpRoute method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteHttpRouteRequest {
    /// Required. A name of the HttpRoute to delete. Must be in the format
    /// `projects/*/locations/global/httpRoutes/*`.
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl DeleteHttpRouteRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::DeleteHttpRouteRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for DeleteHttpRouteRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.DeleteHttpRouteRequest"
    }
}

/// Mesh represents a logical configuration grouping for workload to workload
/// communication within a service mesh. Routes that point to mesh dictate how
/// requests are routed within this logical mesh boundary.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Mesh {
    /// Identifier. Name of the Mesh resource. It matches pattern
    /// `projects/*/locations/global/meshes/<mesh_name>`.
    pub name: std::string::String,

    /// Output only. Server-defined URL of this resource
    pub self_link: std::string::String,

    /// Output only. The timestamp when the resource was created.
    pub create_time: std::option::Option<wkt::Timestamp>,

    /// Output only. The timestamp when the resource was updated.
    pub update_time: std::option::Option<wkt::Timestamp>,

    /// Optional. Set of label tags associated with the Mesh resource.
    pub labels: std::collections::HashMap<std::string::String, std::string::String>,

    /// Optional. A free-text description of the resource. Max length 1024
    /// characters.
    pub description: std::string::String,

    /// Optional. If set to a valid TCP port (1-65535), instructs the SIDECAR proxy
    /// to listen on the specified port of localhost (127.0.0.1) address. The
    /// SIDECAR proxy will expect all traffic to be redirected to this port
    /// regardless of its actual ip:port destination. If unset, a port '15001' is
    /// used as the interception port. This is applicable only for sidecar proxy
    /// deployments.
    pub interception_port: i32,

    /// Optional. Determines if envoy will insert internal debug headers into
    /// upstream requests. Other Envoy headers may still be injected. By default,
    /// envoy will not insert any debug headers.
    pub envoy_headers: std::option::Option<crate::model::EnvoyHeaders>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl Mesh {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::Mesh::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [self_link][crate::model::Mesh::self_link].
    pub fn set_self_link<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.self_link = v.into();
        self
    }

    /// Sets the value of [create_time][crate::model::Mesh::create_time].
    pub fn set_create_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [create_time][crate::model::Mesh::create_time].
    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [update_time][crate::model::Mesh::update_time].
    pub fn set_update_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_time][crate::model::Mesh::update_time].
    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [labels][crate::model::Mesh::labels].
    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<std::string::String>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }

    /// Sets the value of [description][crate::model::Mesh::description].
    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.description = v.into();
        self
    }

    /// Sets the value of [interception_port][crate::model::Mesh::interception_port].
    pub fn set_interception_port<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.interception_port = v.into();
        self
    }

    /// Sets the value of [envoy_headers][crate::model::Mesh::envoy_headers].
    pub fn set_envoy_headers<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::EnvoyHeaders>,
    {
        self.envoy_headers = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [envoy_headers][crate::model::Mesh::envoy_headers].
    pub fn set_or_clear_envoy_headers<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::EnvoyHeaders>,
    {
        self.envoy_headers = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for Mesh {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.Mesh"
    }
}

/// Request used with the ListMeshes method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListMeshesRequest {
    /// Required. The project and location from which the Meshes should be
    /// listed, specified in the format `projects/*/locations/global`.
    pub parent: std::string::String,

    /// Maximum number of Meshes to return per call.
    pub page_size: i32,

    /// The value returned by the last `ListMeshesResponse`
    /// Indicates that this is a continuation of a prior `ListMeshes` call,
    /// and that the system should return the next page of data.
    pub page_token: std::string::String,

    /// Optional. If true, allow partial responses for multi-regional Aggregated
    /// List requests. Otherwise if one of the locations is down or unreachable,
    /// the Aggregated List request will fail.
    pub return_partial_success: bool,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListMeshesRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::ListMeshesRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [page_size][crate::model::ListMeshesRequest::page_size].
    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.page_size = v.into();
        self
    }

    /// Sets the value of [page_token][crate::model::ListMeshesRequest::page_token].
    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.page_token = v.into();
        self
    }

    /// Sets the value of [return_partial_success][crate::model::ListMeshesRequest::return_partial_success].
    pub fn set_return_partial_success<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.return_partial_success = v.into();
        self
    }
}

impl wkt::message::Message for ListMeshesRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.ListMeshesRequest"
    }
}

/// Response returned by the ListMeshes method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListMeshesResponse {
    /// List of Mesh resources.
    pub meshes: std::vec::Vec<crate::model::Mesh>,

    /// If there might be more results than those appearing in this response, then
    /// `next_page_token` is included. To get the next set of results, call this
    /// method again using the value of `next_page_token` as `page_token`.
    pub next_page_token: std::string::String,

    /// Unreachable resources. Populated when the request opts into
    /// `return_partial_success` and reading across collections e.g. when
    /// attempting to list all resources across all supported locations.
    pub unreachable: std::vec::Vec<std::string::String>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListMeshesResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [meshes][crate::model::ListMeshesResponse::meshes].
    pub fn set_meshes<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::Mesh>,
    {
        use std::iter::Iterator;
        self.meshes = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [next_page_token][crate::model::ListMeshesResponse::next_page_token].
    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.next_page_token = v.into();
        self
    }

    /// Sets the value of [unreachable][crate::model::ListMeshesResponse::unreachable].
    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.unreachable = v.into_iter().map(|i| i.into()).collect();
        self
    }
}

impl wkt::message::Message for ListMeshesResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.ListMeshesResponse"
    }
}

#[doc(hidden)]
impl gax::paginator::internal::PageableResponse for ListMeshesResponse {
    type PageItem = crate::model::Mesh;

    fn items(self) -> std::vec::Vec<Self::PageItem> {
        self.meshes
    }

    fn next_page_token(&self) -> std::string::String {
        use std::clone::Clone;
        self.next_page_token.clone()
    }
}

/// Request used by the GetMesh method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetMeshRequest {
    /// Required. A name of the Mesh to get. Must be in the format
    /// `projects/*/locations/global/meshes/*`.
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GetMeshRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::GetMeshRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for GetMeshRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.GetMeshRequest"
    }
}

/// Request used by the CreateMesh method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateMeshRequest {
    /// Required. The parent resource of the Mesh. Must be in the
    /// format `projects/*/locations/global`.
    pub parent: std::string::String,

    /// Required. Short name of the Mesh resource to be created.
    pub mesh_id: std::string::String,

    /// Required. Mesh resource to be created.
    pub mesh: std::option::Option<crate::model::Mesh>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl CreateMeshRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::CreateMeshRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [mesh_id][crate::model::CreateMeshRequest::mesh_id].
    pub fn set_mesh_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.mesh_id = v.into();
        self
    }

    /// Sets the value of [mesh][crate::model::CreateMeshRequest::mesh].
    pub fn set_mesh<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::Mesh>,
    {
        self.mesh = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [mesh][crate::model::CreateMeshRequest::mesh].
    pub fn set_or_clear_mesh<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::Mesh>,
    {
        self.mesh = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for CreateMeshRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.CreateMeshRequest"
    }
}

/// Request used by the UpdateMesh method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateMeshRequest {
    /// Optional. Field mask is used to specify the fields to be overwritten in the
    /// Mesh resource by the update.
    /// The fields specified in the update_mask are relative to the resource, not
    /// the full request. A field will be overwritten if it is in the mask. If the
    /// user does not provide a mask then all fields will be overwritten.
    pub update_mask: std::option::Option<wkt::FieldMask>,

    /// Required. Updated Mesh resource.
    pub mesh: std::option::Option<crate::model::Mesh>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl UpdateMeshRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [update_mask][crate::model::UpdateMeshRequest::update_mask].
    pub fn set_update_mask<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_mask][crate::model::UpdateMeshRequest::update_mask].
    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = v.map(|x| x.into());
        self
    }

    /// Sets the value of [mesh][crate::model::UpdateMeshRequest::mesh].
    pub fn set_mesh<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::Mesh>,
    {
        self.mesh = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [mesh][crate::model::UpdateMeshRequest::mesh].
    pub fn set_or_clear_mesh<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::Mesh>,
    {
        self.mesh = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for UpdateMeshRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.UpdateMeshRequest"
    }
}

/// Request used by the DeleteMesh method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteMeshRequest {
    /// Required. A name of the Mesh to delete. Must be in the format
    /// `projects/*/locations/global/meshes/*`.
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl DeleteMeshRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::DeleteMeshRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for DeleteMeshRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.DeleteMeshRequest"
    }
}

/// GatewayRouteView defines view-only resource for Routes to a Gateway
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GatewayRouteView {
    /// Output only. Identifier. Full path name of the GatewayRouteView resource.
    /// Format:
    /// projects/{project_number}/locations/{location}/gateways/{gateway}/routeViews/{route_view}
    pub name: std::string::String,

    /// Output only. Project number where the route exists.
    pub route_project_number: i64,

    /// Output only. Location where the route exists.
    pub route_location: std::string::String,

    /// Output only. Type of the route: HttpRoute,GrpcRoute,TcpRoute, or TlsRoute
    pub route_type: std::string::String,

    /// Output only. The resource id for the route.
    pub route_id: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GatewayRouteView {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::GatewayRouteView::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [route_project_number][crate::model::GatewayRouteView::route_project_number].
    pub fn set_route_project_number<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
        self.route_project_number = v.into();
        self
    }

    /// Sets the value of [route_location][crate::model::GatewayRouteView::route_location].
    pub fn set_route_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.route_location = v.into();
        self
    }

    /// Sets the value of [route_type][crate::model::GatewayRouteView::route_type].
    pub fn set_route_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.route_type = v.into();
        self
    }

    /// Sets the value of [route_id][crate::model::GatewayRouteView::route_id].
    pub fn set_route_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.route_id = v.into();
        self
    }
}

impl wkt::message::Message for GatewayRouteView {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.GatewayRouteView"
    }
}

/// MeshRouteView defines view-only resource for Routes to a Mesh
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct MeshRouteView {
    /// Output only. Identifier. Full path name of the MeshRouteView resource.
    /// Format:
    /// projects/{project}/locations/{location}/meshes/{mesh}/routeViews/{route_view}
    pub name: std::string::String,

    /// Output only. Project number where the route exists.
    pub route_project_number: i64,

    /// Output only. Location where the route exists.
    pub route_location: std::string::String,

    /// Output only. Type of the route: HttpRoute,GrpcRoute,TcpRoute, or TlsRoute
    pub route_type: std::string::String,

    /// Output only. The resource id for the route.
    pub route_id: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl MeshRouteView {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::MeshRouteView::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [route_project_number][crate::model::MeshRouteView::route_project_number].
    pub fn set_route_project_number<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
        self.route_project_number = v.into();
        self
    }

    /// Sets the value of [route_location][crate::model::MeshRouteView::route_location].
    pub fn set_route_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.route_location = v.into();
        self
    }

    /// Sets the value of [route_type][crate::model::MeshRouteView::route_type].
    pub fn set_route_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.route_type = v.into();
        self
    }

    /// Sets the value of [route_id][crate::model::MeshRouteView::route_id].
    pub fn set_route_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.route_id = v.into();
        self
    }
}

impl wkt::message::Message for MeshRouteView {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.MeshRouteView"
    }
}

/// Request used with the GetGatewayRouteView method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetGatewayRouteViewRequest {
    /// Required. Name of the GatewayRouteView resource.
    /// Formats:
    /// projects/{project}/locations/{location}/gateways/{gateway}/routeViews/{route_view}
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GetGatewayRouteViewRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::GetGatewayRouteViewRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for GetGatewayRouteViewRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.GetGatewayRouteViewRequest"
    }
}

/// Request used with the GetMeshRouteView method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetMeshRouteViewRequest {
    /// Required. Name of the MeshRouteView resource.
    /// Format:
    /// projects/{project}/locations/{location}/meshes/{mesh}/routeViews/{route_view}
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GetMeshRouteViewRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::GetMeshRouteViewRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for GetMeshRouteViewRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.GetMeshRouteViewRequest"
    }
}

/// Request used with the ListGatewayRouteViews method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListGatewayRouteViewsRequest {
    /// Required. The Gateway to which a Route is associated.
    /// Formats:
    /// projects/{project}/locations/{location}/gateways/{gateway}
    pub parent: std::string::String,

    /// Maximum number of GatewayRouteViews to return per call.
    pub page_size: i32,

    /// The value returned by the last `ListGatewayRouteViewsResponse`
    /// Indicates that this is a continuation of a prior `ListGatewayRouteViews`
    /// call, and that the system should return the next page of data.
    pub page_token: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListGatewayRouteViewsRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::ListGatewayRouteViewsRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [page_size][crate::model::ListGatewayRouteViewsRequest::page_size].
    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.page_size = v.into();
        self
    }

    /// Sets the value of [page_token][crate::model::ListGatewayRouteViewsRequest::page_token].
    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.page_token = v.into();
        self
    }
}

impl wkt::message::Message for ListGatewayRouteViewsRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.ListGatewayRouteViewsRequest"
    }
}

/// Request used with the ListMeshRouteViews method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListMeshRouteViewsRequest {
    /// Required. The Mesh to which a Route is associated.
    /// Format:
    /// projects/{project}/locations/{location}/meshes/{mesh}
    pub parent: std::string::String,

    /// Maximum number of MeshRouteViews to return per call.
    pub page_size: i32,

    /// The value returned by the last `ListMeshRouteViewsResponse`
    /// Indicates that this is a continuation of a prior `ListMeshRouteViews` call,
    /// and that the system should return the next page of data.
    pub page_token: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListMeshRouteViewsRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::ListMeshRouteViewsRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [page_size][crate::model::ListMeshRouteViewsRequest::page_size].
    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.page_size = v.into();
        self
    }

    /// Sets the value of [page_token][crate::model::ListMeshRouteViewsRequest::page_token].
    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.page_token = v.into();
        self
    }
}

impl wkt::message::Message for ListMeshRouteViewsRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.ListMeshRouteViewsRequest"
    }
}

/// Response returned by the ListGatewayRouteViews method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListGatewayRouteViewsResponse {
    /// List of GatewayRouteView resources.
    pub gateway_route_views: std::vec::Vec<crate::model::GatewayRouteView>,

    /// A token, which can be sent as `page_token` to retrieve the next page.
    /// If this field is omitted, there are no subsequent pages.
    pub next_page_token: std::string::String,

    /// Unreachable resources. Populated when the request attempts to list all
    /// resources across all supported locations, while some locations are
    /// temporarily unavailable.
    pub unreachable: std::vec::Vec<std::string::String>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListGatewayRouteViewsResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [gateway_route_views][crate::model::ListGatewayRouteViewsResponse::gateway_route_views].
    pub fn set_gateway_route_views<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::GatewayRouteView>,
    {
        use std::iter::Iterator;
        self.gateway_route_views = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [next_page_token][crate::model::ListGatewayRouteViewsResponse::next_page_token].
    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.next_page_token = v.into();
        self
    }

    /// Sets the value of [unreachable][crate::model::ListGatewayRouteViewsResponse::unreachable].
    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.unreachable = v.into_iter().map(|i| i.into()).collect();
        self
    }
}

impl wkt::message::Message for ListGatewayRouteViewsResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.ListGatewayRouteViewsResponse"
    }
}

#[doc(hidden)]
impl gax::paginator::internal::PageableResponse for ListGatewayRouteViewsResponse {
    type PageItem = crate::model::GatewayRouteView;

    fn items(self) -> std::vec::Vec<Self::PageItem> {
        self.gateway_route_views
    }

    fn next_page_token(&self) -> std::string::String {
        use std::clone::Clone;
        self.next_page_token.clone()
    }
}

/// Response returned by the ListMeshRouteViews method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListMeshRouteViewsResponse {
    /// List of MeshRouteView resources.
    pub mesh_route_views: std::vec::Vec<crate::model::MeshRouteView>,

    /// A token, which can be sent as `page_token` to retrieve the next page.
    /// If this field is omitted, there are no subsequent pages.
    pub next_page_token: std::string::String,

    /// Unreachable resources. Populated when the request attempts to list all
    /// resources across all supported locations, while some locations are
    /// temporarily unavailable.
    pub unreachable: std::vec::Vec<std::string::String>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListMeshRouteViewsResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [mesh_route_views][crate::model::ListMeshRouteViewsResponse::mesh_route_views].
    pub fn set_mesh_route_views<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::MeshRouteView>,
    {
        use std::iter::Iterator;
        self.mesh_route_views = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [next_page_token][crate::model::ListMeshRouteViewsResponse::next_page_token].
    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.next_page_token = v.into();
        self
    }

    /// Sets the value of [unreachable][crate::model::ListMeshRouteViewsResponse::unreachable].
    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.unreachable = v.into_iter().map(|i| i.into()).collect();
        self
    }
}

impl wkt::message::Message for ListMeshRouteViewsResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.ListMeshRouteViewsResponse"
    }
}

#[doc(hidden)]
impl gax::paginator::internal::PageableResponse for ListMeshRouteViewsResponse {
    type PageItem = crate::model::MeshRouteView;

    fn items(self) -> std::vec::Vec<Self::PageItem> {
        self.mesh_route_views
    }

    fn next_page_token(&self) -> std::string::String {
        use std::clone::Clone;
        self.next_page_token.clone()
    }
}

/// ServiceBinding can be used to:
///
/// - Bind a Service Directory Service to be used in a BackendService resource.
///   This feature will be deprecated soon.
/// - Bind a Private Service Connect producer service to be used in consumer
///   Cloud Service Mesh or Application Load Balancers.
/// - Bind a Cloud Run service to be used in consumer Cloud Service Mesh or
///   Application Load Balancers.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ServiceBinding {
    /// Identifier. Name of the ServiceBinding resource. It matches pattern
    /// `projects/*/locations/*/serviceBindings/<service_binding_name>`.
    pub name: std::string::String,

    /// Optional. A free-text description of the resource. Max length 1024
    /// characters.
    pub description: std::string::String,

    /// Output only. The timestamp when the resource was created.
    pub create_time: std::option::Option<wkt::Timestamp>,

    /// Output only. The timestamp when the resource was updated.
    pub update_time: std::option::Option<wkt::Timestamp>,

    /// Optional. The full Service Directory Service name of the format
    /// `projects/*/locations/*/namespaces/*/services/*`.
    /// This field is for Service Directory integration which will be deprecated
    /// soon.
    #[deprecated]
    pub service: std::string::String,

    /// Output only. The unique identifier of the Service Directory Service against
    /// which the ServiceBinding resource is validated. This is populated when the
    /// Service Binding resource is used in another resource (like Backend
    /// Service). This is of the UUID4 format. This field is for Service Directory
    /// integration which will be deprecated soon.
    #[deprecated]
    pub service_id: std::string::String,

    /// Optional. Set of label tags associated with the ServiceBinding resource.
    pub labels: std::collections::HashMap<std::string::String, std::string::String>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ServiceBinding {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::ServiceBinding::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [description][crate::model::ServiceBinding::description].
    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.description = v.into();
        self
    }

    /// Sets the value of [create_time][crate::model::ServiceBinding::create_time].
    pub fn set_create_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [create_time][crate::model::ServiceBinding::create_time].
    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [update_time][crate::model::ServiceBinding::update_time].
    pub fn set_update_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_time][crate::model::ServiceBinding::update_time].
    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [service][crate::model::ServiceBinding::service].
    #[deprecated]
    pub fn set_service<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.service = v.into();
        self
    }

    /// Sets the value of [service_id][crate::model::ServiceBinding::service_id].
    #[deprecated]
    pub fn set_service_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.service_id = v.into();
        self
    }

    /// Sets the value of [labels][crate::model::ServiceBinding::labels].
    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<std::string::String>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }
}

impl wkt::message::Message for ServiceBinding {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.ServiceBinding"
    }
}

/// Request used with the ListServiceBindings method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListServiceBindingsRequest {
    /// Required. The project and location from which the ServiceBindings should be
    /// listed, specified in the format `projects/*/locations/*`.
    pub parent: std::string::String,

    /// Maximum number of ServiceBindings to return per call.
    pub page_size: i32,

    /// The value returned by the last `ListServiceBindingsResponse`
    /// Indicates that this is a continuation of a prior `ListRouters` call,
    /// and that the system should return the next page of data.
    pub page_token: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListServiceBindingsRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::ListServiceBindingsRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [page_size][crate::model::ListServiceBindingsRequest::page_size].
    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.page_size = v.into();
        self
    }

    /// Sets the value of [page_token][crate::model::ListServiceBindingsRequest::page_token].
    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.page_token = v.into();
        self
    }
}

impl wkt::message::Message for ListServiceBindingsRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.ListServiceBindingsRequest"
    }
}

/// Response returned by the ListServiceBindings method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListServiceBindingsResponse {
    /// List of ServiceBinding resources.
    pub service_bindings: std::vec::Vec<crate::model::ServiceBinding>,

    /// If there might be more results than those appearing in this response, then
    /// `next_page_token` is included. To get the next set of results, call this
    /// method again using the value of `next_page_token` as `page_token`.
    pub next_page_token: std::string::String,

    /// Unreachable resources. Populated when the request attempts to list all
    /// resources across all supported locations, while some locations are
    /// temporarily unavailable.
    pub unreachable: std::vec::Vec<std::string::String>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListServiceBindingsResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [service_bindings][crate::model::ListServiceBindingsResponse::service_bindings].
    pub fn set_service_bindings<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::ServiceBinding>,
    {
        use std::iter::Iterator;
        self.service_bindings = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [next_page_token][crate::model::ListServiceBindingsResponse::next_page_token].
    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.next_page_token = v.into();
        self
    }

    /// Sets the value of [unreachable][crate::model::ListServiceBindingsResponse::unreachable].
    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.unreachable = v.into_iter().map(|i| i.into()).collect();
        self
    }
}

impl wkt::message::Message for ListServiceBindingsResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.ListServiceBindingsResponse"
    }
}

#[doc(hidden)]
impl gax::paginator::internal::PageableResponse for ListServiceBindingsResponse {
    type PageItem = crate::model::ServiceBinding;

    fn items(self) -> std::vec::Vec<Self::PageItem> {
        self.service_bindings
    }

    fn next_page_token(&self) -> std::string::String {
        use std::clone::Clone;
        self.next_page_token.clone()
    }
}

/// Request used by the GetServiceBinding method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetServiceBindingRequest {
    /// Required. A name of the ServiceBinding to get. Must be in the format
    /// `projects/*/locations/*/serviceBindings/*`.
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GetServiceBindingRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::GetServiceBindingRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for GetServiceBindingRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.GetServiceBindingRequest"
    }
}

/// Request used by the ServiceBinding method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateServiceBindingRequest {
    /// Required. The parent resource of the ServiceBinding. Must be in the
    /// format `projects/*/locations/*`.
    pub parent: std::string::String,

    /// Required. Short name of the ServiceBinding resource to be created.
    pub service_binding_id: std::string::String,

    /// Required. ServiceBinding resource to be created.
    pub service_binding: std::option::Option<crate::model::ServiceBinding>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl CreateServiceBindingRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::CreateServiceBindingRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [service_binding_id][crate::model::CreateServiceBindingRequest::service_binding_id].
    pub fn set_service_binding_id<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.service_binding_id = v.into();
        self
    }

    /// Sets the value of [service_binding][crate::model::CreateServiceBindingRequest::service_binding].
    pub fn set_service_binding<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::ServiceBinding>,
    {
        self.service_binding = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [service_binding][crate::model::CreateServiceBindingRequest::service_binding].
    pub fn set_or_clear_service_binding<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::ServiceBinding>,
    {
        self.service_binding = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for CreateServiceBindingRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.CreateServiceBindingRequest"
    }
}

/// Request used by the UpdateServiceBinding method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateServiceBindingRequest {
    /// Optional. Field mask is used to specify the fields to be overwritten in the
    /// ServiceBinding resource by the update.
    /// The fields specified in the update_mask are relative to the resource, not
    /// the full request. A field will be overwritten if it is in the mask. If the
    /// user does not provide a mask then all fields will be overwritten.
    pub update_mask: std::option::Option<wkt::FieldMask>,

    /// Required. Updated ServiceBinding resource.
    pub service_binding: std::option::Option<crate::model::ServiceBinding>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl UpdateServiceBindingRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [update_mask][crate::model::UpdateServiceBindingRequest::update_mask].
    pub fn set_update_mask<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_mask][crate::model::UpdateServiceBindingRequest::update_mask].
    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = v.map(|x| x.into());
        self
    }

    /// Sets the value of [service_binding][crate::model::UpdateServiceBindingRequest::service_binding].
    pub fn set_service_binding<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::ServiceBinding>,
    {
        self.service_binding = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [service_binding][crate::model::UpdateServiceBindingRequest::service_binding].
    pub fn set_or_clear_service_binding<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::ServiceBinding>,
    {
        self.service_binding = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for UpdateServiceBindingRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.UpdateServiceBindingRequest"
    }
}

/// Request used by the DeleteServiceBinding method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteServiceBindingRequest {
    /// Required. A name of the ServiceBinding to delete. Must be in the format
    /// `projects/*/locations/*/serviceBindings/*`.
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl DeleteServiceBindingRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::DeleteServiceBindingRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for DeleteServiceBindingRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.DeleteServiceBindingRequest"
    }
}

/// ServiceLbPolicy holds global load balancing and traffic distribution
/// configuration that can be applied to a BackendService.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ServiceLbPolicy {
    /// Identifier. Name of the ServiceLbPolicy resource. It matches pattern
    /// `projects/{project}/locations/{location}/serviceLbPolicies/{service_lb_policy_name}`.
    pub name: std::string::String,

    /// Output only. The timestamp when this resource was created.
    pub create_time: std::option::Option<wkt::Timestamp>,

    /// Output only. The timestamp when this resource was last updated.
    pub update_time: std::option::Option<wkt::Timestamp>,

    /// Optional. Set of label tags associated with the ServiceLbPolicy resource.
    pub labels: std::collections::HashMap<std::string::String, std::string::String>,

    /// Optional. A free-text description of the resource. Max length 1024
    /// characters.
    pub description: std::string::String,

    /// Optional. The type of load balancing algorithm to be used. The default
    /// behavior is WATERFALL_BY_REGION.
    pub load_balancing_algorithm: crate::model::service_lb_policy::LoadBalancingAlgorithm,

    /// Optional. Configuration to automatically move traffic away for unhealthy
    /// IG/NEG for the associated Backend Service.
    pub auto_capacity_drain:
        std::option::Option<crate::model::service_lb_policy::AutoCapacityDrain>,

    /// Optional. Configuration related to health based failover.
    pub failover_config: std::option::Option<crate::model::service_lb_policy::FailoverConfig>,

    /// Optional. Configuration to provide isolation support for the associated
    /// Backend Service.
    pub isolation_config: std::option::Option<crate::model::service_lb_policy::IsolationConfig>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ServiceLbPolicy {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::ServiceLbPolicy::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [create_time][crate::model::ServiceLbPolicy::create_time].
    pub fn set_create_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [create_time][crate::model::ServiceLbPolicy::create_time].
    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [update_time][crate::model::ServiceLbPolicy::update_time].
    pub fn set_update_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_time][crate::model::ServiceLbPolicy::update_time].
    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [labels][crate::model::ServiceLbPolicy::labels].
    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<std::string::String>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }

    /// Sets the value of [description][crate::model::ServiceLbPolicy::description].
    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.description = v.into();
        self
    }

    /// Sets the value of [load_balancing_algorithm][crate::model::ServiceLbPolicy::load_balancing_algorithm].
    pub fn set_load_balancing_algorithm<
        T: std::convert::Into<crate::model::service_lb_policy::LoadBalancingAlgorithm>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.load_balancing_algorithm = v.into();
        self
    }

    /// Sets the value of [auto_capacity_drain][crate::model::ServiceLbPolicy::auto_capacity_drain].
    pub fn set_auto_capacity_drain<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::service_lb_policy::AutoCapacityDrain>,
    {
        self.auto_capacity_drain = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [auto_capacity_drain][crate::model::ServiceLbPolicy::auto_capacity_drain].
    pub fn set_or_clear_auto_capacity_drain<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::service_lb_policy::AutoCapacityDrain>,
    {
        self.auto_capacity_drain = v.map(|x| x.into());
        self
    }

    /// Sets the value of [failover_config][crate::model::ServiceLbPolicy::failover_config].
    pub fn set_failover_config<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::service_lb_policy::FailoverConfig>,
    {
        self.failover_config = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [failover_config][crate::model::ServiceLbPolicy::failover_config].
    pub fn set_or_clear_failover_config<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::service_lb_policy::FailoverConfig>,
    {
        self.failover_config = v.map(|x| x.into());
        self
    }

    /// Sets the value of [isolation_config][crate::model::ServiceLbPolicy::isolation_config].
    pub fn set_isolation_config<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::service_lb_policy::IsolationConfig>,
    {
        self.isolation_config = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [isolation_config][crate::model::ServiceLbPolicy::isolation_config].
    pub fn set_or_clear_isolation_config<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::service_lb_policy::IsolationConfig>,
    {
        self.isolation_config = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for ServiceLbPolicy {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.ServiceLbPolicy"
    }
}

/// Defines additional types related to [ServiceLbPolicy].
pub mod service_lb_policy {
    #[allow(unused_imports)]
    use super::*;

    /// Option to specify if an unhealthy IG/NEG should be considered for global
    /// load balancing and traffic routing.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct AutoCapacityDrain {
        /// Optional. If set to 'True', an unhealthy IG/NEG will be set as drained.
        ///
        /// - An IG/NEG is considered unhealthy if less than 25% of the
        ///   instances/endpoints in the IG/NEG are healthy.
        /// - This option will never result in draining more than 50% of the
        ///   configured IGs/NEGs for the Backend Service.
        pub enable: bool,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl AutoCapacityDrain {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [enable][crate::model::service_lb_policy::AutoCapacityDrain::enable].
        pub fn set_enable<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
            self.enable = v.into();
            self
        }
    }

    impl wkt::message::Message for AutoCapacityDrain {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.networkservices.v1.ServiceLbPolicy.AutoCapacityDrain"
        }
    }

    /// Option to specify health based failover behavior.
    /// This is not related to Network load balancer FailoverPolicy.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct FailoverConfig {
        /// Optional. The percentage threshold that a load balancer will begin to
        /// send traffic to failover backends. If the percentage of endpoints in a
        /// MIG/NEG is smaller than this value, traffic would be sent to failover
        /// backends if possible. This field should be set to a value between 1
        /// and 99. The default value is 50 for Global external HTTP(S) load balancer
        /// (classic) and Proxyless service mesh, and 70 for others.
        pub failover_health_threshold: i32,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl FailoverConfig {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [failover_health_threshold][crate::model::service_lb_policy::FailoverConfig::failover_health_threshold].
        pub fn set_failover_health_threshold<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
            self.failover_health_threshold = v.into();
            self
        }
    }

    impl wkt::message::Message for FailoverConfig {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.networkservices.v1.ServiceLbPolicy.FailoverConfig"
        }
    }

    /// Configuration to provide isolation support for the associated Backend
    /// Service.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct IsolationConfig {
        /// Optional. The isolation granularity of the load balancer.
        pub isolation_granularity: crate::model::service_lb_policy::IsolationGranularity,

        /// Optional. The isolation mode of the load balancer.
        pub isolation_mode: crate::model::service_lb_policy::IsolationMode,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl IsolationConfig {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [isolation_granularity][crate::model::service_lb_policy::IsolationConfig::isolation_granularity].
        pub fn set_isolation_granularity<
            T: std::convert::Into<crate::model::service_lb_policy::IsolationGranularity>,
        >(
            mut self,
            v: T,
        ) -> Self {
            self.isolation_granularity = v.into();
            self
        }

        /// Sets the value of [isolation_mode][crate::model::service_lb_policy::IsolationConfig::isolation_mode].
        pub fn set_isolation_mode<
            T: std::convert::Into<crate::model::service_lb_policy::IsolationMode>,
        >(
            mut self,
            v: T,
        ) -> Self {
            self.isolation_mode = v.into();
            self
        }
    }

    impl wkt::message::Message for IsolationConfig {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.networkservices.v1.ServiceLbPolicy.IsolationConfig"
        }
    }

    /// The global load balancing algorithm to be used.
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum LoadBalancingAlgorithm {
        /// The type of the loadbalancing algorithm is unspecified.
        Unspecified,
        /// Balance traffic across all backends across the world proportionally based
        /// on capacity.
        SprayToWorld,
        /// Direct traffic to the nearest region with endpoints and capacity before
        /// spilling over to other regions and spread the traffic from each client to
        /// all the MIGs/NEGs in a region.
        SprayToRegion,
        /// Direct traffic to the nearest region with endpoints and capacity before
        /// spilling over to other regions. All MIGs/NEGs within a region are evenly
        /// loaded but each client might not spread the traffic to all the MIGs/NEGs
        /// in the region.
        WaterfallByRegion,
        /// Attempt to keep traffic in a single zone closest to the client, before
        /// spilling over to other zones.
        WaterfallByZone,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [LoadBalancingAlgorithm::value] or
        /// [LoadBalancingAlgorithm::name].
        UnknownValue(load_balancing_algorithm::UnknownValue),
    }

    #[doc(hidden)]
    pub mod load_balancing_algorithm {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl LoadBalancingAlgorithm {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::SprayToWorld => std::option::Option::Some(3),
                Self::SprayToRegion => std::option::Option::Some(4),
                Self::WaterfallByRegion => std::option::Option::Some(5),
                Self::WaterfallByZone => std::option::Option::Some(6),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => {
                    std::option::Option::Some("LOAD_BALANCING_ALGORITHM_UNSPECIFIED")
                }
                Self::SprayToWorld => std::option::Option::Some("SPRAY_TO_WORLD"),
                Self::SprayToRegion => std::option::Option::Some("SPRAY_TO_REGION"),
                Self::WaterfallByRegion => std::option::Option::Some("WATERFALL_BY_REGION"),
                Self::WaterfallByZone => std::option::Option::Some("WATERFALL_BY_ZONE"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for LoadBalancingAlgorithm {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for LoadBalancingAlgorithm {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for LoadBalancingAlgorithm {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                3 => Self::SprayToWorld,
                4 => Self::SprayToRegion,
                5 => Self::WaterfallByRegion,
                6 => Self::WaterfallByZone,
                _ => Self::UnknownValue(load_balancing_algorithm::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for LoadBalancingAlgorithm {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "LOAD_BALANCING_ALGORITHM_UNSPECIFIED" => Self::Unspecified,
                "SPRAY_TO_WORLD" => Self::SprayToWorld,
                "SPRAY_TO_REGION" => Self::SprayToRegion,
                "WATERFALL_BY_REGION" => Self::WaterfallByRegion,
                "WATERFALL_BY_ZONE" => Self::WaterfallByZone,
                _ => Self::UnknownValue(load_balancing_algorithm::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for LoadBalancingAlgorithm {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::SprayToWorld => serializer.serialize_i32(3),
                Self::SprayToRegion => serializer.serialize_i32(4),
                Self::WaterfallByRegion => serializer.serialize_i32(5),
                Self::WaterfallByZone => serializer.serialize_i32(6),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for LoadBalancingAlgorithm {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<LoadBalancingAlgorithm>::new(
                ".google.cloud.networkservices.v1.ServiceLbPolicy.LoadBalancingAlgorithm",
            ))
        }
    }

    /// The granularity of this isolation restriction.
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum IsolationGranularity {
        /// No isolation is configured for the backend service. Traffic can overflow
        /// based on the load balancing algorithm.
        Unspecified,
        /// Traffic for this service will be isolated at the cloud region level.
        Region,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [IsolationGranularity::value] or
        /// [IsolationGranularity::name].
        UnknownValue(isolation_granularity::UnknownValue),
    }

    #[doc(hidden)]
    pub mod isolation_granularity {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl IsolationGranularity {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::Region => std::option::Option::Some(1),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => std::option::Option::Some("ISOLATION_GRANULARITY_UNSPECIFIED"),
                Self::Region => std::option::Option::Some("REGION"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for IsolationGranularity {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for IsolationGranularity {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for IsolationGranularity {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                1 => Self::Region,
                _ => Self::UnknownValue(isolation_granularity::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for IsolationGranularity {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "ISOLATION_GRANULARITY_UNSPECIFIED" => Self::Unspecified,
                "REGION" => Self::Region,
                _ => Self::UnknownValue(isolation_granularity::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for IsolationGranularity {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::Region => serializer.serialize_i32(1),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for IsolationGranularity {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<IsolationGranularity>::new(
                ".google.cloud.networkservices.v1.ServiceLbPolicy.IsolationGranularity",
            ))
        }
    }

    /// The mode of this isolation restriction, defining whether clients in a given
    /// region are allowed to reach out to another region.
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum IsolationMode {
        /// No isolation mode is configured for the backend service.
        Unspecified,
        /// Traffic will be sent to the nearest region.
        Nearest,
        /// Traffic will fail if no serving backends are available in the same region
        /// as the load balancer.
        Strict,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [IsolationMode::value] or
        /// [IsolationMode::name].
        UnknownValue(isolation_mode::UnknownValue),
    }

    #[doc(hidden)]
    pub mod isolation_mode {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl IsolationMode {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::Nearest => std::option::Option::Some(1),
                Self::Strict => std::option::Option::Some(2),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => std::option::Option::Some("ISOLATION_MODE_UNSPECIFIED"),
                Self::Nearest => std::option::Option::Some("NEAREST"),
                Self::Strict => std::option::Option::Some("STRICT"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for IsolationMode {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for IsolationMode {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for IsolationMode {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                1 => Self::Nearest,
                2 => Self::Strict,
                _ => Self::UnknownValue(isolation_mode::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for IsolationMode {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "ISOLATION_MODE_UNSPECIFIED" => Self::Unspecified,
                "NEAREST" => Self::Nearest,
                "STRICT" => Self::Strict,
                _ => Self::UnknownValue(isolation_mode::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for IsolationMode {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::Nearest => serializer.serialize_i32(1),
                Self::Strict => serializer.serialize_i32(2),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for IsolationMode {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<IsolationMode>::new(
                ".google.cloud.networkservices.v1.ServiceLbPolicy.IsolationMode",
            ))
        }
    }
}

/// Request used with the ListServiceLbPolicies method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListServiceLbPoliciesRequest {
    /// Required. The project and location from which the ServiceLbPolicies should
    /// be listed, specified in the format
    /// `projects/{project}/locations/{location}`.
    pub parent: std::string::String,

    /// Maximum number of ServiceLbPolicies to return per call.
    pub page_size: i32,

    /// The value returned by the last `ListServiceLbPoliciesResponse`
    /// Indicates that this is a continuation of a prior `ListRouters` call,
    /// and that the system should return the next page of data.
    pub page_token: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListServiceLbPoliciesRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::ListServiceLbPoliciesRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [page_size][crate::model::ListServiceLbPoliciesRequest::page_size].
    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.page_size = v.into();
        self
    }

    /// Sets the value of [page_token][crate::model::ListServiceLbPoliciesRequest::page_token].
    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.page_token = v.into();
        self
    }
}

impl wkt::message::Message for ListServiceLbPoliciesRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.ListServiceLbPoliciesRequest"
    }
}

/// Response returned by the ListServiceLbPolicies method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListServiceLbPoliciesResponse {
    /// List of ServiceLbPolicy resources.
    pub service_lb_policies: std::vec::Vec<crate::model::ServiceLbPolicy>,

    /// If there might be more results than those appearing in this response, then
    /// `next_page_token` is included. To get the next set of results, call this
    /// method again using the value of `next_page_token` as `page_token`.
    pub next_page_token: std::string::String,

    /// Unreachable resources. Populated when the request attempts to list all
    /// resources across all supported locations, while some locations are
    /// temporarily unavailable.
    pub unreachable: std::vec::Vec<std::string::String>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListServiceLbPoliciesResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [service_lb_policies][crate::model::ListServiceLbPoliciesResponse::service_lb_policies].
    pub fn set_service_lb_policies<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::ServiceLbPolicy>,
    {
        use std::iter::Iterator;
        self.service_lb_policies = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [next_page_token][crate::model::ListServiceLbPoliciesResponse::next_page_token].
    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.next_page_token = v.into();
        self
    }

    /// Sets the value of [unreachable][crate::model::ListServiceLbPoliciesResponse::unreachable].
    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.unreachable = v.into_iter().map(|i| i.into()).collect();
        self
    }
}

impl wkt::message::Message for ListServiceLbPoliciesResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.ListServiceLbPoliciesResponse"
    }
}

#[doc(hidden)]
impl gax::paginator::internal::PageableResponse for ListServiceLbPoliciesResponse {
    type PageItem = crate::model::ServiceLbPolicy;

    fn items(self) -> std::vec::Vec<Self::PageItem> {
        self.service_lb_policies
    }

    fn next_page_token(&self) -> std::string::String {
        use std::clone::Clone;
        self.next_page_token.clone()
    }
}

/// Request used by the GetServiceLbPolicy method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetServiceLbPolicyRequest {
    /// Required. A name of the ServiceLbPolicy to get. Must be in the format
    /// `projects/{project}/locations/{location}/serviceLbPolicies/*`.
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GetServiceLbPolicyRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::GetServiceLbPolicyRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for GetServiceLbPolicyRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.GetServiceLbPolicyRequest"
    }
}

/// Request used by the ServiceLbPolicy method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateServiceLbPolicyRequest {
    /// Required. The parent resource of the ServiceLbPolicy. Must be in the
    /// format `projects/{project}/locations/{location}`.
    pub parent: std::string::String,

    /// Required. Short name of the ServiceLbPolicy resource to be created.
    /// E.g. for resource name
    /// `projects/{project}/locations/{location}/serviceLbPolicies/{service_lb_policy_name}`.
    /// the id is value of {service_lb_policy_name}
    pub service_lb_policy_id: std::string::String,

    /// Required. ServiceLbPolicy resource to be created.
    pub service_lb_policy: std::option::Option<crate::model::ServiceLbPolicy>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl CreateServiceLbPolicyRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::CreateServiceLbPolicyRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [service_lb_policy_id][crate::model::CreateServiceLbPolicyRequest::service_lb_policy_id].
    pub fn set_service_lb_policy_id<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.service_lb_policy_id = v.into();
        self
    }

    /// Sets the value of [service_lb_policy][crate::model::CreateServiceLbPolicyRequest::service_lb_policy].
    pub fn set_service_lb_policy<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::ServiceLbPolicy>,
    {
        self.service_lb_policy = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [service_lb_policy][crate::model::CreateServiceLbPolicyRequest::service_lb_policy].
    pub fn set_or_clear_service_lb_policy<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::ServiceLbPolicy>,
    {
        self.service_lb_policy = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for CreateServiceLbPolicyRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.CreateServiceLbPolicyRequest"
    }
}

/// Request used by the UpdateServiceLbPolicy method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateServiceLbPolicyRequest {
    /// Optional. Field mask is used to specify the fields to be overwritten in the
    /// ServiceLbPolicy resource by the update.
    /// The fields specified in the update_mask are relative to the resource, not
    /// the full request. A field will be overwritten if it is in the mask. If the
    /// user does not provide a mask then all fields will be overwritten.
    pub update_mask: std::option::Option<wkt::FieldMask>,

    /// Required. Updated ServiceLbPolicy resource.
    pub service_lb_policy: std::option::Option<crate::model::ServiceLbPolicy>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl UpdateServiceLbPolicyRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [update_mask][crate::model::UpdateServiceLbPolicyRequest::update_mask].
    pub fn set_update_mask<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_mask][crate::model::UpdateServiceLbPolicyRequest::update_mask].
    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = v.map(|x| x.into());
        self
    }

    /// Sets the value of [service_lb_policy][crate::model::UpdateServiceLbPolicyRequest::service_lb_policy].
    pub fn set_service_lb_policy<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::ServiceLbPolicy>,
    {
        self.service_lb_policy = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [service_lb_policy][crate::model::UpdateServiceLbPolicyRequest::service_lb_policy].
    pub fn set_or_clear_service_lb_policy<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::ServiceLbPolicy>,
    {
        self.service_lb_policy = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for UpdateServiceLbPolicyRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.UpdateServiceLbPolicyRequest"
    }
}

/// Request used by the DeleteServiceLbPolicy method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteServiceLbPolicyRequest {
    /// Required. A name of the ServiceLbPolicy to delete. Must be in the format
    /// `projects/{project}/locations/{location}/serviceLbPolicies/*`.
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl DeleteServiceLbPolicyRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::DeleteServiceLbPolicyRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for DeleteServiceLbPolicyRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.DeleteServiceLbPolicyRequest"
    }
}

/// TcpRoute is the resource defining how TCP traffic should be routed by a
/// Mesh/Gateway resource.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct TcpRoute {
    /// Identifier. Name of the TcpRoute resource. It matches pattern
    /// `projects/*/locations/global/tcpRoutes/tcp_route_name>`.
    pub name: std::string::String,

    /// Output only. Server-defined URL of this resource
    pub self_link: std::string::String,

    /// Output only. The timestamp when the resource was created.
    pub create_time: std::option::Option<wkt::Timestamp>,

    /// Output only. The timestamp when the resource was updated.
    pub update_time: std::option::Option<wkt::Timestamp>,

    /// Optional. A free-text description of the resource. Max length 1024
    /// characters.
    pub description: std::string::String,

    /// Required. Rules that define how traffic is routed and handled. At least one
    /// RouteRule must be supplied. If there are multiple rules then the action
    /// taken will be the first rule to match.
    pub rules: std::vec::Vec<crate::model::tcp_route::RouteRule>,

    /// Optional. Meshes defines a list of meshes this TcpRoute is attached to, as
    /// one of the routing rules to route the requests served by the mesh.
    ///
    /// Each mesh reference should match the pattern:
    /// `projects/*/locations/global/meshes/<mesh_name>`
    ///
    /// The attached Mesh should be of a type SIDECAR
    pub meshes: std::vec::Vec<std::string::String>,

    /// Optional. Gateways defines a list of gateways this TcpRoute is attached to,
    /// as one of the routing rules to route the requests served by the gateway.
    ///
    /// Each gateway reference should match the pattern:
    /// `projects/*/locations/global/gateways/<gateway_name>`
    pub gateways: std::vec::Vec<std::string::String>,

    /// Optional. Set of label tags associated with the TcpRoute resource.
    pub labels: std::collections::HashMap<std::string::String, std::string::String>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl TcpRoute {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::TcpRoute::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [self_link][crate::model::TcpRoute::self_link].
    pub fn set_self_link<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.self_link = v.into();
        self
    }

    /// Sets the value of [create_time][crate::model::TcpRoute::create_time].
    pub fn set_create_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [create_time][crate::model::TcpRoute::create_time].
    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [update_time][crate::model::TcpRoute::update_time].
    pub fn set_update_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_time][crate::model::TcpRoute::update_time].
    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [description][crate::model::TcpRoute::description].
    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.description = v.into();
        self
    }

    /// Sets the value of [rules][crate::model::TcpRoute::rules].
    pub fn set_rules<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::tcp_route::RouteRule>,
    {
        use std::iter::Iterator;
        self.rules = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [meshes][crate::model::TcpRoute::meshes].
    pub fn set_meshes<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.meshes = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [gateways][crate::model::TcpRoute::gateways].
    pub fn set_gateways<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.gateways = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [labels][crate::model::TcpRoute::labels].
    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<std::string::String>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }
}

impl wkt::message::Message for TcpRoute {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.TcpRoute"
    }
}

/// Defines additional types related to [TcpRoute].
pub mod tcp_route {
    #[allow(unused_imports)]
    use super::*;

    /// Specifies how to match traffic and how to route traffic when traffic is
    /// matched.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct RouteRule {
        /// Optional. RouteMatch defines the predicate used to match requests to a
        /// given action. Multiple match types are "OR"ed for evaluation. If no
        /// routeMatch field is specified, this rule will unconditionally match
        /// traffic.
        pub matches: std::vec::Vec<crate::model::tcp_route::RouteMatch>,

        /// Required. The detailed rule defining how to route matched traffic.
        pub action: std::option::Option<crate::model::tcp_route::RouteAction>,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl RouteRule {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [matches][crate::model::tcp_route::RouteRule::matches].
        pub fn set_matches<T, V>(mut self, v: T) -> Self
        where
            T: std::iter::IntoIterator<Item = V>,
            V: std::convert::Into<crate::model::tcp_route::RouteMatch>,
        {
            use std::iter::Iterator;
            self.matches = v.into_iter().map(|i| i.into()).collect();
            self
        }

        /// Sets the value of [action][crate::model::tcp_route::RouteRule::action].
        pub fn set_action<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<crate::model::tcp_route::RouteAction>,
        {
            self.action = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [action][crate::model::tcp_route::RouteRule::action].
        pub fn set_or_clear_action<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<crate::model::tcp_route::RouteAction>,
        {
            self.action = v.map(|x| x.into());
            self
        }
    }

    impl wkt::message::Message for RouteRule {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.networkservices.v1.TcpRoute.RouteRule"
        }
    }

    /// RouteMatch defines the predicate used to match requests to a given action.
    /// Multiple match types are "OR"ed for evaluation.
    /// If no routeMatch field is specified, this rule will unconditionally match
    /// traffic.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct RouteMatch {
        /// Required. Must be specified in the CIDR range format. A CIDR range
        /// consists of an IP Address and a prefix length to construct the subnet
        /// mask. By default, the prefix length is 32 (i.e. matches a single IP
        /// address). Only IPV4 addresses are supported. Examples: "10.0.0.1" -
        /// matches against this exact IP address. "10.0.0.0/8" - matches against any
        /// IP address within the 10.0.0.0 subnet and 255.255.255.0 mask. "0.0.0.0/0"
        ///
        /// - matches against any IP address'.
        pub address: std::string::String,

        /// Required. Specifies the destination port to match against.
        pub port: std::string::String,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl RouteMatch {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [address][crate::model::tcp_route::RouteMatch::address].
        pub fn set_address<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
            self.address = v.into();
            self
        }

        /// Sets the value of [port][crate::model::tcp_route::RouteMatch::port].
        pub fn set_port<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
            self.port = v.into();
            self
        }
    }

    impl wkt::message::Message for RouteMatch {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.networkservices.v1.TcpRoute.RouteMatch"
        }
    }

    /// The specifications for routing traffic and applying associated policies.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct RouteAction {
        /// Optional. The destination services to which traffic should be forwarded.
        /// At least one destination service is required. Only one of route
        /// destination or original destination can be set.
        pub destinations: std::vec::Vec<crate::model::tcp_route::RouteDestination>,

        /// Optional. If true, Router will use the destination IP and port of the
        /// original connection as the destination of the request. Default is false.
        /// Only one of route destinations or original destination can be set.
        pub original_destination: bool,

        /// Optional. Specifies the idle timeout for the selected route. The idle
        /// timeout is defined as the period in which there are no bytes sent or
        /// received on either the upstream or downstream connection. If not set, the
        /// default idle timeout is 30 seconds. If set to 0s, the timeout will be
        /// disabled.
        pub idle_timeout: std::option::Option<wkt::Duration>,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl RouteAction {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [destinations][crate::model::tcp_route::RouteAction::destinations].
        pub fn set_destinations<T, V>(mut self, v: T) -> Self
        where
            T: std::iter::IntoIterator<Item = V>,
            V: std::convert::Into<crate::model::tcp_route::RouteDestination>,
        {
            use std::iter::Iterator;
            self.destinations = v.into_iter().map(|i| i.into()).collect();
            self
        }

        /// Sets the value of [original_destination][crate::model::tcp_route::RouteAction::original_destination].
        pub fn set_original_destination<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
            self.original_destination = v.into();
            self
        }

        /// Sets the value of [idle_timeout][crate::model::tcp_route::RouteAction::idle_timeout].
        pub fn set_idle_timeout<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<wkt::Duration>,
        {
            self.idle_timeout = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [idle_timeout][crate::model::tcp_route::RouteAction::idle_timeout].
        pub fn set_or_clear_idle_timeout<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<wkt::Duration>,
        {
            self.idle_timeout = v.map(|x| x.into());
            self
        }
    }

    impl wkt::message::Message for RouteAction {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.networkservices.v1.TcpRoute.RouteAction"
        }
    }

    /// Describe the destination for traffic to be routed to.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct RouteDestination {
        /// Required. The URL of a BackendService to route traffic to.
        pub service_name: std::string::String,

        /// Optional. Specifies the proportion of requests forwarded to the backend
        /// referenced by the serviceName field. This is computed as:
        ///
        /// - weight/Sum(weights in this destination list).
        ///   For non-zero values, there may be some epsilon from the exact proportion
        ///   defined here depending on the precision an implementation supports.
        ///
        /// If only one serviceName is specified and it has a weight greater than 0,
        /// 100% of the traffic is forwarded to that backend.
        ///
        /// If weights are specified for any one service name, they need to be
        /// specified for all of them.
        ///
        /// If weights are unspecified for all services, then, traffic is distributed
        /// in equal proportions to all of them.
        pub weight: i32,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl RouteDestination {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [service_name][crate::model::tcp_route::RouteDestination::service_name].
        pub fn set_service_name<T: std::convert::Into<std::string::String>>(
            mut self,
            v: T,
        ) -> Self {
            self.service_name = v.into();
            self
        }

        /// Sets the value of [weight][crate::model::tcp_route::RouteDestination::weight].
        pub fn set_weight<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
            self.weight = v.into();
            self
        }
    }

    impl wkt::message::Message for RouteDestination {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.networkservices.v1.TcpRoute.RouteDestination"
        }
    }
}

/// Request used with the ListTcpRoutes method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListTcpRoutesRequest {
    /// Required. The project and location from which the TcpRoutes should be
    /// listed, specified in the format `projects/*/locations/global`.
    pub parent: std::string::String,

    /// Maximum number of TcpRoutes to return per call.
    pub page_size: i32,

    /// The value returned by the last `ListTcpRoutesResponse`
    /// Indicates that this is a continuation of a prior `ListTcpRoutes` call,
    /// and that the system should return the next page of data.
    pub page_token: std::string::String,

    /// Optional. If true, allow partial responses for multi-regional Aggregated
    /// List requests. Otherwise if one of the locations is down or unreachable,
    /// the Aggregated List request will fail.
    pub return_partial_success: bool,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListTcpRoutesRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::ListTcpRoutesRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [page_size][crate::model::ListTcpRoutesRequest::page_size].
    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.page_size = v.into();
        self
    }

    /// Sets the value of [page_token][crate::model::ListTcpRoutesRequest::page_token].
    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.page_token = v.into();
        self
    }

    /// Sets the value of [return_partial_success][crate::model::ListTcpRoutesRequest::return_partial_success].
    pub fn set_return_partial_success<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.return_partial_success = v.into();
        self
    }
}

impl wkt::message::Message for ListTcpRoutesRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.ListTcpRoutesRequest"
    }
}

/// Response returned by the ListTcpRoutes method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListTcpRoutesResponse {
    /// List of TcpRoute resources.
    pub tcp_routes: std::vec::Vec<crate::model::TcpRoute>,

    /// If there might be more results than those appearing in this response, then
    /// `next_page_token` is included. To get the next set of results, call this
    /// method again using the value of `next_page_token` as `page_token`.
    pub next_page_token: std::string::String,

    /// Unreachable resources. Populated when the request opts into
    /// [return_partial_success][google.cloud.networkservices.v1.ListTcpRoutesRequest.return_partial_success]
    /// and reading across collections e.g. when attempting to list all resources
    /// across all supported locations.
    ///
    /// [google.cloud.networkservices.v1.ListTcpRoutesRequest.return_partial_success]: crate::model::ListTcpRoutesRequest::return_partial_success
    pub unreachable: std::vec::Vec<std::string::String>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListTcpRoutesResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [tcp_routes][crate::model::ListTcpRoutesResponse::tcp_routes].
    pub fn set_tcp_routes<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::TcpRoute>,
    {
        use std::iter::Iterator;
        self.tcp_routes = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [next_page_token][crate::model::ListTcpRoutesResponse::next_page_token].
    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.next_page_token = v.into();
        self
    }

    /// Sets the value of [unreachable][crate::model::ListTcpRoutesResponse::unreachable].
    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.unreachable = v.into_iter().map(|i| i.into()).collect();
        self
    }
}

impl wkt::message::Message for ListTcpRoutesResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.ListTcpRoutesResponse"
    }
}

#[doc(hidden)]
impl gax::paginator::internal::PageableResponse for ListTcpRoutesResponse {
    type PageItem = crate::model::TcpRoute;

    fn items(self) -> std::vec::Vec<Self::PageItem> {
        self.tcp_routes
    }

    fn next_page_token(&self) -> std::string::String {
        use std::clone::Clone;
        self.next_page_token.clone()
    }
}

/// Request used by the GetTcpRoute method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetTcpRouteRequest {
    /// Required. A name of the TcpRoute to get. Must be in the format
    /// `projects/*/locations/global/tcpRoutes/*`.
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GetTcpRouteRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::GetTcpRouteRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for GetTcpRouteRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.GetTcpRouteRequest"
    }
}

/// Request used by the TcpRoute method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateTcpRouteRequest {
    /// Required. The parent resource of the TcpRoute. Must be in the
    /// format `projects/*/locations/global`.
    pub parent: std::string::String,

    /// Required. Short name of the TcpRoute resource to be created.
    pub tcp_route_id: std::string::String,

    /// Required. TcpRoute resource to be created.
    pub tcp_route: std::option::Option<crate::model::TcpRoute>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl CreateTcpRouteRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::CreateTcpRouteRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [tcp_route_id][crate::model::CreateTcpRouteRequest::tcp_route_id].
    pub fn set_tcp_route_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.tcp_route_id = v.into();
        self
    }

    /// Sets the value of [tcp_route][crate::model::CreateTcpRouteRequest::tcp_route].
    pub fn set_tcp_route<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::TcpRoute>,
    {
        self.tcp_route = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [tcp_route][crate::model::CreateTcpRouteRequest::tcp_route].
    pub fn set_or_clear_tcp_route<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::TcpRoute>,
    {
        self.tcp_route = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for CreateTcpRouteRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.CreateTcpRouteRequest"
    }
}

/// Request used by the UpdateTcpRoute method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateTcpRouteRequest {
    /// Optional. Field mask is used to specify the fields to be overwritten in the
    /// TcpRoute resource by the update.
    /// The fields specified in the update_mask are relative to the resource, not
    /// the full request. A field will be overwritten if it is in the mask. If the
    /// user does not provide a mask then all fields will be overwritten.
    pub update_mask: std::option::Option<wkt::FieldMask>,

    /// Required. Updated TcpRoute resource.
    pub tcp_route: std::option::Option<crate::model::TcpRoute>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl UpdateTcpRouteRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [update_mask][crate::model::UpdateTcpRouteRequest::update_mask].
    pub fn set_update_mask<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_mask][crate::model::UpdateTcpRouteRequest::update_mask].
    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = v.map(|x| x.into());
        self
    }

    /// Sets the value of [tcp_route][crate::model::UpdateTcpRouteRequest::tcp_route].
    pub fn set_tcp_route<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::TcpRoute>,
    {
        self.tcp_route = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [tcp_route][crate::model::UpdateTcpRouteRequest::tcp_route].
    pub fn set_or_clear_tcp_route<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::TcpRoute>,
    {
        self.tcp_route = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for UpdateTcpRouteRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.UpdateTcpRouteRequest"
    }
}

/// Request used by the DeleteTcpRoute method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteTcpRouteRequest {
    /// Required. A name of the TcpRoute to delete. Must be in the format
    /// `projects/*/locations/global/tcpRoutes/*`.
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl DeleteTcpRouteRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::DeleteTcpRouteRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for DeleteTcpRouteRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.DeleteTcpRouteRequest"
    }
}

/// TlsRoute defines how traffic should be routed based on SNI and other matching
/// L3 attributes.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct TlsRoute {
    /// Identifier. Name of the TlsRoute resource. It matches pattern
    /// `projects/*/locations/global/tlsRoutes/tls_route_name>`.
    pub name: std::string::String,

    /// Output only. Server-defined URL of this resource
    pub self_link: std::string::String,

    /// Output only. The timestamp when the resource was created.
    pub create_time: std::option::Option<wkt::Timestamp>,

    /// Output only. The timestamp when the resource was updated.
    pub update_time: std::option::Option<wkt::Timestamp>,

    /// Optional. A free-text description of the resource. Max length 1024
    /// characters.
    pub description: std::string::String,

    /// Required. Rules that define how traffic is routed and handled. At least one
    /// RouteRule must be supplied. If there are multiple rules then the action
    /// taken will be the first rule to match.
    pub rules: std::vec::Vec<crate::model::tls_route::RouteRule>,

    /// Optional. Meshes defines a list of meshes this TlsRoute is attached to, as
    /// one of the routing rules to route the requests served by the mesh.
    ///
    /// Each mesh reference should match the pattern:
    /// `projects/*/locations/global/meshes/<mesh_name>`
    ///
    /// The attached Mesh should be of a type SIDECAR
    pub meshes: std::vec::Vec<std::string::String>,

    /// Optional. Gateways defines a list of gateways this TlsRoute is attached to,
    /// as one of the routing rules to route the requests served by the gateway.
    ///
    /// Each gateway reference should match the pattern:
    /// `projects/*/locations/global/gateways/<gateway_name>`
    pub gateways: std::vec::Vec<std::string::String>,

    /// Optional. Set of label tags associated with the TlsRoute resource.
    pub labels: std::collections::HashMap<std::string::String, std::string::String>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl TlsRoute {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::TlsRoute::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [self_link][crate::model::TlsRoute::self_link].
    pub fn set_self_link<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.self_link = v.into();
        self
    }

    /// Sets the value of [create_time][crate::model::TlsRoute::create_time].
    pub fn set_create_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [create_time][crate::model::TlsRoute::create_time].
    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [update_time][crate::model::TlsRoute::update_time].
    pub fn set_update_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_time][crate::model::TlsRoute::update_time].
    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [description][crate::model::TlsRoute::description].
    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.description = v.into();
        self
    }

    /// Sets the value of [rules][crate::model::TlsRoute::rules].
    pub fn set_rules<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::tls_route::RouteRule>,
    {
        use std::iter::Iterator;
        self.rules = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [meshes][crate::model::TlsRoute::meshes].
    pub fn set_meshes<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.meshes = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [gateways][crate::model::TlsRoute::gateways].
    pub fn set_gateways<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.gateways = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [labels][crate::model::TlsRoute::labels].
    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<std::string::String>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }
}

impl wkt::message::Message for TlsRoute {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.TlsRoute"
    }
}

/// Defines additional types related to [TlsRoute].
pub mod tls_route {
    #[allow(unused_imports)]
    use super::*;

    /// Specifies how to match traffic and how to route traffic when traffic is
    /// matched.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct RouteRule {
        /// Required. RouteMatch defines the predicate used to match requests to a
        /// given action. Multiple match types are "OR"ed for evaluation. Atleast one
        /// RouteMatch must be supplied.
        pub matches: std::vec::Vec<crate::model::tls_route::RouteMatch>,

        /// Required. The detailed rule defining how to route matched traffic.
        pub action: std::option::Option<crate::model::tls_route::RouteAction>,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl RouteRule {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [matches][crate::model::tls_route::RouteRule::matches].
        pub fn set_matches<T, V>(mut self, v: T) -> Self
        where
            T: std::iter::IntoIterator<Item = V>,
            V: std::convert::Into<crate::model::tls_route::RouteMatch>,
        {
            use std::iter::Iterator;
            self.matches = v.into_iter().map(|i| i.into()).collect();
            self
        }

        /// Sets the value of [action][crate::model::tls_route::RouteRule::action].
        pub fn set_action<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<crate::model::tls_route::RouteAction>,
        {
            self.action = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [action][crate::model::tls_route::RouteRule::action].
        pub fn set_or_clear_action<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<crate::model::tls_route::RouteAction>,
        {
            self.action = v.map(|x| x.into());
            self
        }
    }

    impl wkt::message::Message for RouteRule {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.networkservices.v1.TlsRoute.RouteRule"
        }
    }

    /// RouteMatch defines the predicate used to match requests to a given action.
    /// Multiple match types are "AND"ed for evaluation.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct RouteMatch {
        /// Optional. SNI (server name indicator) to match against.
        /// SNI will be matched against all wildcard domains, i.e. `www.example.com`
        /// will be first matched against `www.example.com`, then `*.example.com`,
        /// then `*.com.`
        /// Partial wildcards are not supported, and values like *w.example.com are
        /// invalid.
        /// At least one of sni_host and alpn is required.
        /// Up to 100 sni hosts across all matches can be set.
        pub sni_host: std::vec::Vec<std::string::String>,

        /// Optional. ALPN (Application-Layer Protocol Negotiation) to match against.
        /// Examples: "http/1.1", "h2".
        /// At least one of sni_host and alpn is required.
        /// Up to 5 alpns across all matches can be set.
        pub alpn: std::vec::Vec<std::string::String>,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl RouteMatch {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [sni_host][crate::model::tls_route::RouteMatch::sni_host].
        pub fn set_sni_host<T, V>(mut self, v: T) -> Self
        where
            T: std::iter::IntoIterator<Item = V>,
            V: std::convert::Into<std::string::String>,
        {
            use std::iter::Iterator;
            self.sni_host = v.into_iter().map(|i| i.into()).collect();
            self
        }

        /// Sets the value of [alpn][crate::model::tls_route::RouteMatch::alpn].
        pub fn set_alpn<T, V>(mut self, v: T) -> Self
        where
            T: std::iter::IntoIterator<Item = V>,
            V: std::convert::Into<std::string::String>,
        {
            use std::iter::Iterator;
            self.alpn = v.into_iter().map(|i| i.into()).collect();
            self
        }
    }

    impl wkt::message::Message for RouteMatch {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.networkservices.v1.TlsRoute.RouteMatch"
        }
    }

    /// The specifications for routing traffic and applying associated policies.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct RouteAction {
        /// Required. The destination services to which traffic should be forwarded.
        /// At least one destination service is required.
        pub destinations: std::vec::Vec<crate::model::tls_route::RouteDestination>,

        /// Optional. Specifies the idle timeout for the selected route. The idle
        /// timeout is defined as the period in which there are no bytes sent or
        /// received on either the upstream or downstream connection. If not set, the
        /// default idle timeout is 1 hour. If set to 0s, the timeout will be
        /// disabled.
        pub idle_timeout: std::option::Option<wkt::Duration>,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl RouteAction {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [destinations][crate::model::tls_route::RouteAction::destinations].
        pub fn set_destinations<T, V>(mut self, v: T) -> Self
        where
            T: std::iter::IntoIterator<Item = V>,
            V: std::convert::Into<crate::model::tls_route::RouteDestination>,
        {
            use std::iter::Iterator;
            self.destinations = v.into_iter().map(|i| i.into()).collect();
            self
        }

        /// Sets the value of [idle_timeout][crate::model::tls_route::RouteAction::idle_timeout].
        pub fn set_idle_timeout<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<wkt::Duration>,
        {
            self.idle_timeout = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [idle_timeout][crate::model::tls_route::RouteAction::idle_timeout].
        pub fn set_or_clear_idle_timeout<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<wkt::Duration>,
        {
            self.idle_timeout = v.map(|x| x.into());
            self
        }
    }

    impl wkt::message::Message for RouteAction {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.networkservices.v1.TlsRoute.RouteAction"
        }
    }

    /// Describe the destination for traffic to be routed to.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct RouteDestination {
        /// Required. The URL of a BackendService to route traffic to.
        pub service_name: std::string::String,

        /// Optional. Specifies the proportion of requests forwarded to the backend
        /// referenced by the service_name field. This is computed as:
        ///
        /// - weight/Sum(weights in destinations)
        ///   Weights in all destinations does not need to sum up to 100.
        pub weight: i32,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl RouteDestination {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [service_name][crate::model::tls_route::RouteDestination::service_name].
        pub fn set_service_name<T: std::convert::Into<std::string::String>>(
            mut self,
            v: T,
        ) -> Self {
            self.service_name = v.into();
            self
        }

        /// Sets the value of [weight][crate::model::tls_route::RouteDestination::weight].
        pub fn set_weight<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
            self.weight = v.into();
            self
        }
    }

    impl wkt::message::Message for RouteDestination {
        fn typename() -> &'static str {
            "type.googleapis.com/google.cloud.networkservices.v1.TlsRoute.RouteDestination"
        }
    }
}

/// Request used with the ListTlsRoutes method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListTlsRoutesRequest {
    /// Required. The project and location from which the TlsRoutes should be
    /// listed, specified in the format `projects/*/locations/global`.
    pub parent: std::string::String,

    /// Maximum number of TlsRoutes to return per call.
    pub page_size: i32,

    /// The value returned by the last `ListTlsRoutesResponse`
    /// Indicates that this is a continuation of a prior `ListTlsRoutes` call,
    /// and that the system should return the next page of data.
    pub page_token: std::string::String,

    /// Optional. If true, allow partial responses for multi-regional Aggregated
    /// List requests. Otherwise if one of the locations is down or unreachable,
    /// the Aggregated List request will fail.
    pub return_partial_success: bool,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListTlsRoutesRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::ListTlsRoutesRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [page_size][crate::model::ListTlsRoutesRequest::page_size].
    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.page_size = v.into();
        self
    }

    /// Sets the value of [page_token][crate::model::ListTlsRoutesRequest::page_token].
    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.page_token = v.into();
        self
    }

    /// Sets the value of [return_partial_success][crate::model::ListTlsRoutesRequest::return_partial_success].
    pub fn set_return_partial_success<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.return_partial_success = v.into();
        self
    }
}

impl wkt::message::Message for ListTlsRoutesRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.ListTlsRoutesRequest"
    }
}

/// Response returned by the ListTlsRoutes method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListTlsRoutesResponse {
    /// List of TlsRoute resources.
    pub tls_routes: std::vec::Vec<crate::model::TlsRoute>,

    /// If there might be more results than those appearing in this response, then
    /// `next_page_token` is included. To get the next set of results, call this
    /// method again using the value of `next_page_token` as `page_token`.
    pub next_page_token: std::string::String,

    /// Unreachable resources. Populated when the request opts into
    /// [return_partial_success][google.cloud.networkservices.v1.ListTlsRoutesRequest.return_partial_success]
    /// and reading across collections e.g. when attempting to list all resources
    /// across all supported locations.
    ///
    /// [google.cloud.networkservices.v1.ListTlsRoutesRequest.return_partial_success]: crate::model::ListTlsRoutesRequest::return_partial_success
    pub unreachable: std::vec::Vec<std::string::String>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListTlsRoutesResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [tls_routes][crate::model::ListTlsRoutesResponse::tls_routes].
    pub fn set_tls_routes<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::TlsRoute>,
    {
        use std::iter::Iterator;
        self.tls_routes = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [next_page_token][crate::model::ListTlsRoutesResponse::next_page_token].
    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.next_page_token = v.into();
        self
    }

    /// Sets the value of [unreachable][crate::model::ListTlsRoutesResponse::unreachable].
    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.unreachable = v.into_iter().map(|i| i.into()).collect();
        self
    }
}

impl wkt::message::Message for ListTlsRoutesResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.ListTlsRoutesResponse"
    }
}

#[doc(hidden)]
impl gax::paginator::internal::PageableResponse for ListTlsRoutesResponse {
    type PageItem = crate::model::TlsRoute;

    fn items(self) -> std::vec::Vec<Self::PageItem> {
        self.tls_routes
    }

    fn next_page_token(&self) -> std::string::String {
        use std::clone::Clone;
        self.next_page_token.clone()
    }
}

/// Request used by the GetTlsRoute method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetTlsRouteRequest {
    /// Required. A name of the TlsRoute to get. Must be in the format
    /// `projects/*/locations/global/tlsRoutes/*`.
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GetTlsRouteRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::GetTlsRouteRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for GetTlsRouteRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.GetTlsRouteRequest"
    }
}

/// Request used by the TlsRoute method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateTlsRouteRequest {
    /// Required. The parent resource of the TlsRoute. Must be in the
    /// format `projects/*/locations/global`.
    pub parent: std::string::String,

    /// Required. Short name of the TlsRoute resource to be created.
    pub tls_route_id: std::string::String,

    /// Required. TlsRoute resource to be created.
    pub tls_route: std::option::Option<crate::model::TlsRoute>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl CreateTlsRouteRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::CreateTlsRouteRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [tls_route_id][crate::model::CreateTlsRouteRequest::tls_route_id].
    pub fn set_tls_route_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.tls_route_id = v.into();
        self
    }

    /// Sets the value of [tls_route][crate::model::CreateTlsRouteRequest::tls_route].
    pub fn set_tls_route<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::TlsRoute>,
    {
        self.tls_route = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [tls_route][crate::model::CreateTlsRouteRequest::tls_route].
    pub fn set_or_clear_tls_route<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::TlsRoute>,
    {
        self.tls_route = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for CreateTlsRouteRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.CreateTlsRouteRequest"
    }
}

/// Request used by the UpdateTlsRoute method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateTlsRouteRequest {
    /// Optional. Field mask is used to specify the fields to be overwritten in the
    /// TlsRoute resource by the update.
    /// The fields specified in the update_mask are relative to the resource, not
    /// the full request. A field will be overwritten if it is in the mask. If the
    /// user does not provide a mask then all fields will be overwritten.
    pub update_mask: std::option::Option<wkt::FieldMask>,

    /// Required. Updated TlsRoute resource.
    pub tls_route: std::option::Option<crate::model::TlsRoute>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl UpdateTlsRouteRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [update_mask][crate::model::UpdateTlsRouteRequest::update_mask].
    pub fn set_update_mask<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_mask][crate::model::UpdateTlsRouteRequest::update_mask].
    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = v.map(|x| x.into());
        self
    }

    /// Sets the value of [tls_route][crate::model::UpdateTlsRouteRequest::tls_route].
    pub fn set_tls_route<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::TlsRoute>,
    {
        self.tls_route = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [tls_route][crate::model::UpdateTlsRouteRequest::tls_route].
    pub fn set_or_clear_tls_route<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::TlsRoute>,
    {
        self.tls_route = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for UpdateTlsRouteRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.UpdateTlsRouteRequest"
    }
}

/// Request used by the DeleteTlsRoute method.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteTlsRouteRequest {
    /// Required. A name of the TlsRoute to delete. Must be in the format
    /// `projects/*/locations/global/tlsRoutes/*`.
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl DeleteTlsRouteRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::DeleteTlsRouteRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for DeleteTlsRouteRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.networkservices.v1.DeleteTlsRouteRequest"
    }
}

/// EnvoyHeader configuration for Mesh and Gateway
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum EnvoyHeaders {
    /// Defaults to NONE.
    Unspecified,
    /// Suppress envoy debug headers.
    None,
    /// Envoy will insert default internal debug headers into upstream requests:
    /// x-envoy-attempt-count
    /// x-envoy-is-timeout-retry
    /// x-envoy-expected-rq-timeout-ms
    /// x-envoy-original-path
    /// x-envoy-upstream-stream-duration-ms
    DebugHeaders,
    /// If set, the enum was initialized with an unknown value.
    ///
    /// Applications can examine the value using [EnvoyHeaders::value] or
    /// [EnvoyHeaders::name].
    UnknownValue(envoy_headers::UnknownValue),
}

#[doc(hidden)]
pub mod envoy_headers {
    #[allow(unused_imports)]
    use super::*;
    #[derive(Clone, Debug, PartialEq)]
    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}

impl EnvoyHeaders {
    /// Gets the enum value.
    ///
    /// Returns `None` if the enum contains an unknown value deserialized from
    /// the string representation of enums.
    pub fn value(&self) -> std::option::Option<i32> {
        match self {
            Self::Unspecified => std::option::Option::Some(0),
            Self::None => std::option::Option::Some(1),
            Self::DebugHeaders => std::option::Option::Some(2),
            Self::UnknownValue(u) => u.0.value(),
        }
    }

    /// Gets the enum value as a string.
    ///
    /// Returns `None` if the enum contains an unknown value deserialized from
    /// the integer representation of enums.
    pub fn name(&self) -> std::option::Option<&str> {
        match self {
            Self::Unspecified => std::option::Option::Some("ENVOY_HEADERS_UNSPECIFIED"),
            Self::None => std::option::Option::Some("NONE"),
            Self::DebugHeaders => std::option::Option::Some("DEBUG_HEADERS"),
            Self::UnknownValue(u) => u.0.name(),
        }
    }
}

impl std::default::Default for EnvoyHeaders {
    fn default() -> Self {
        use std::convert::From;
        Self::from(0)
    }
}

impl std::fmt::Display for EnvoyHeaders {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
        wkt::internal::display_enum(f, self.name(), self.value())
    }
}

impl std::convert::From<i32> for EnvoyHeaders {
    fn from(value: i32) -> Self {
        match value {
            0 => Self::Unspecified,
            1 => Self::None,
            2 => Self::DebugHeaders,
            _ => Self::UnknownValue(envoy_headers::UnknownValue(
                wkt::internal::UnknownEnumValue::Integer(value),
            )),
        }
    }
}

impl std::convert::From<&str> for EnvoyHeaders {
    fn from(value: &str) -> Self {
        use std::string::ToString;
        match value {
            "ENVOY_HEADERS_UNSPECIFIED" => Self::Unspecified,
            "NONE" => Self::None,
            "DEBUG_HEADERS" => Self::DebugHeaders,
            _ => Self::UnknownValue(envoy_headers::UnknownValue(
                wkt::internal::UnknownEnumValue::String(value.to_string()),
            )),
        }
    }
}

impl serde::ser::Serialize for EnvoyHeaders {
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        match self {
            Self::Unspecified => serializer.serialize_i32(0),
            Self::None => serializer.serialize_i32(1),
            Self::DebugHeaders => serializer.serialize_i32(2),
            Self::UnknownValue(u) => u.0.serialize(serializer),
        }
    }
}

impl<'de> serde::de::Deserialize<'de> for EnvoyHeaders {
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        deserializer.deserialize_any(wkt::internal::EnumVisitor::<EnvoyHeaders>::new(
            ".google.cloud.networkservices.v1.EnvoyHeaders",
        ))
    }
}

/// The part of the request or response for which the extension is called.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum EventType {
    /// Unspecified value. Do not use.
    Unspecified,
    /// If included in `supported_events`,
    /// the extension is called when the HTTP request headers arrive.
    RequestHeaders,
    /// If included in `supported_events`,
    /// the extension is called when the HTTP request body arrives.
    RequestBody,
    /// If included in `supported_events`,
    /// the extension is called when the HTTP response headers arrive.
    ResponseHeaders,
    /// If included in `supported_events`,
    /// the extension is called when the HTTP response body arrives.
    ResponseBody,
    /// If included in `supported_events`,
    /// the extension is called when the HTTP request trailers arrives.
    RequestTrailers,
    /// If included in `supported_events`,
    /// the extension is called when the HTTP response trailers arrives.
    ResponseTrailers,
    /// If set, the enum was initialized with an unknown value.
    ///
    /// Applications can examine the value using [EventType::value] or
    /// [EventType::name].
    UnknownValue(event_type::UnknownValue),
}

#[doc(hidden)]
pub mod event_type {
    #[allow(unused_imports)]
    use super::*;
    #[derive(Clone, Debug, PartialEq)]
    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}

impl EventType {
    /// Gets the enum value.
    ///
    /// Returns `None` if the enum contains an unknown value deserialized from
    /// the string representation of enums.
    pub fn value(&self) -> std::option::Option<i32> {
        match self {
            Self::Unspecified => std::option::Option::Some(0),
            Self::RequestHeaders => std::option::Option::Some(1),
            Self::RequestBody => std::option::Option::Some(2),
            Self::ResponseHeaders => std::option::Option::Some(3),
            Self::ResponseBody => std::option::Option::Some(4),
            Self::RequestTrailers => std::option::Option::Some(5),
            Self::ResponseTrailers => std::option::Option::Some(6),
            Self::UnknownValue(u) => u.0.value(),
        }
    }

    /// Gets the enum value as a string.
    ///
    /// Returns `None` if the enum contains an unknown value deserialized from
    /// the integer representation of enums.
    pub fn name(&self) -> std::option::Option<&str> {
        match self {
            Self::Unspecified => std::option::Option::Some("EVENT_TYPE_UNSPECIFIED"),
            Self::RequestHeaders => std::option::Option::Some("REQUEST_HEADERS"),
            Self::RequestBody => std::option::Option::Some("REQUEST_BODY"),
            Self::ResponseHeaders => std::option::Option::Some("RESPONSE_HEADERS"),
            Self::ResponseBody => std::option::Option::Some("RESPONSE_BODY"),
            Self::RequestTrailers => std::option::Option::Some("REQUEST_TRAILERS"),
            Self::ResponseTrailers => std::option::Option::Some("RESPONSE_TRAILERS"),
            Self::UnknownValue(u) => u.0.name(),
        }
    }
}

impl std::default::Default for EventType {
    fn default() -> Self {
        use std::convert::From;
        Self::from(0)
    }
}

impl std::fmt::Display for EventType {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
        wkt::internal::display_enum(f, self.name(), self.value())
    }
}

impl std::convert::From<i32> for EventType {
    fn from(value: i32) -> Self {
        match value {
            0 => Self::Unspecified,
            1 => Self::RequestHeaders,
            2 => Self::RequestBody,
            3 => Self::ResponseHeaders,
            4 => Self::ResponseBody,
            5 => Self::RequestTrailers,
            6 => Self::ResponseTrailers,
            _ => Self::UnknownValue(event_type::UnknownValue(
                wkt::internal::UnknownEnumValue::Integer(value),
            )),
        }
    }
}

impl std::convert::From<&str> for EventType {
    fn from(value: &str) -> Self {
        use std::string::ToString;
        match value {
            "EVENT_TYPE_UNSPECIFIED" => Self::Unspecified,
            "REQUEST_HEADERS" => Self::RequestHeaders,
            "REQUEST_BODY" => Self::RequestBody,
            "RESPONSE_HEADERS" => Self::ResponseHeaders,
            "RESPONSE_BODY" => Self::ResponseBody,
            "REQUEST_TRAILERS" => Self::RequestTrailers,
            "RESPONSE_TRAILERS" => Self::ResponseTrailers,
            _ => Self::UnknownValue(event_type::UnknownValue(
                wkt::internal::UnknownEnumValue::String(value.to_string()),
            )),
        }
    }
}

impl serde::ser::Serialize for EventType {
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        match self {
            Self::Unspecified => serializer.serialize_i32(0),
            Self::RequestHeaders => serializer.serialize_i32(1),
            Self::RequestBody => serializer.serialize_i32(2),
            Self::ResponseHeaders => serializer.serialize_i32(3),
            Self::ResponseBody => serializer.serialize_i32(4),
            Self::RequestTrailers => serializer.serialize_i32(5),
            Self::ResponseTrailers => serializer.serialize_i32(6),
            Self::UnknownValue(u) => u.0.serialize(serializer),
        }
    }
}

impl<'de> serde::de::Deserialize<'de> for EventType {
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        deserializer.deserialize_any(wkt::internal::EnumVisitor::<EventType>::new(
            ".google.cloud.networkservices.v1.EventType",
        ))
    }
}

/// Load balancing schemes supported by the `LbTrafficExtension`,
/// `LbRouteExtension`, and `LbEdgeExtension` resources.
/// For more information, refer to [Backend services
/// overview](https://cloud.google.com/load-balancing/docs/backend-service).
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum LoadBalancingScheme {
    /// Default value. Do not use.
    Unspecified,
    /// Signifies that this is used for Internal HTTP(S) Load Balancing.
    InternalManaged,
    /// Signifies that this is used for External Managed HTTP(S) Load
    /// Balancing.
    ExternalManaged,
    /// If set, the enum was initialized with an unknown value.
    ///
    /// Applications can examine the value using [LoadBalancingScheme::value] or
    /// [LoadBalancingScheme::name].
    UnknownValue(load_balancing_scheme::UnknownValue),
}

#[doc(hidden)]
pub mod load_balancing_scheme {
    #[allow(unused_imports)]
    use super::*;
    #[derive(Clone, Debug, PartialEq)]
    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}

impl LoadBalancingScheme {
    /// Gets the enum value.
    ///
    /// Returns `None` if the enum contains an unknown value deserialized from
    /// the string representation of enums.
    pub fn value(&self) -> std::option::Option<i32> {
        match self {
            Self::Unspecified => std::option::Option::Some(0),
            Self::InternalManaged => std::option::Option::Some(1),
            Self::ExternalManaged => std::option::Option::Some(2),
            Self::UnknownValue(u) => u.0.value(),
        }
    }

    /// Gets the enum value as a string.
    ///
    /// Returns `None` if the enum contains an unknown value deserialized from
    /// the integer representation of enums.
    pub fn name(&self) -> std::option::Option<&str> {
        match self {
            Self::Unspecified => std::option::Option::Some("LOAD_BALANCING_SCHEME_UNSPECIFIED"),
            Self::InternalManaged => std::option::Option::Some("INTERNAL_MANAGED"),
            Self::ExternalManaged => std::option::Option::Some("EXTERNAL_MANAGED"),
            Self::UnknownValue(u) => u.0.name(),
        }
    }
}

impl std::default::Default for LoadBalancingScheme {
    fn default() -> Self {
        use std::convert::From;
        Self::from(0)
    }
}

impl std::fmt::Display for LoadBalancingScheme {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
        wkt::internal::display_enum(f, self.name(), self.value())
    }
}

impl std::convert::From<i32> for LoadBalancingScheme {
    fn from(value: i32) -> Self {
        match value {
            0 => Self::Unspecified,
            1 => Self::InternalManaged,
            2 => Self::ExternalManaged,
            _ => Self::UnknownValue(load_balancing_scheme::UnknownValue(
                wkt::internal::UnknownEnumValue::Integer(value),
            )),
        }
    }
}

impl std::convert::From<&str> for LoadBalancingScheme {
    fn from(value: &str) -> Self {
        use std::string::ToString;
        match value {
            "LOAD_BALANCING_SCHEME_UNSPECIFIED" => Self::Unspecified,
            "INTERNAL_MANAGED" => Self::InternalManaged,
            "EXTERNAL_MANAGED" => Self::ExternalManaged,
            _ => Self::UnknownValue(load_balancing_scheme::UnknownValue(
                wkt::internal::UnknownEnumValue::String(value.to_string()),
            )),
        }
    }
}

impl serde::ser::Serialize for LoadBalancingScheme {
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        match self {
            Self::Unspecified => serializer.serialize_i32(0),
            Self::InternalManaged => serializer.serialize_i32(1),
            Self::ExternalManaged => serializer.serialize_i32(2),
            Self::UnknownValue(u) => u.0.serialize(serializer),
        }
    }
}

impl<'de> serde::de::Deserialize<'de> for LoadBalancingScheme {
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        deserializer.deserialize_any(wkt::internal::EnumVisitor::<LoadBalancingScheme>::new(
            ".google.cloud.networkservices.v1.LoadBalancingScheme",
        ))
    }
}

/// The format of communication supported by the extension.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum WireFormat {
    /// Not specified.
    Unspecified,
    /// The extension service uses ext_proc gRPC API over a gRPC stream. This is
    /// the default value if the wire format is not specified. The backend service
    /// for the extension must use HTTP2 or H2C as the protocol. All
    /// `supported_events` for a client request are sent as part of the same
    /// gRPC stream.
    ExtProcGrpc,
    /// If set, the enum was initialized with an unknown value.
    ///
    /// Applications can examine the value using [WireFormat::value] or
    /// [WireFormat::name].
    UnknownValue(wire_format::UnknownValue),
}

#[doc(hidden)]
pub mod wire_format {
    #[allow(unused_imports)]
    use super::*;
    #[derive(Clone, Debug, PartialEq)]
    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}

impl WireFormat {
    /// Gets the enum value.
    ///
    /// Returns `None` if the enum contains an unknown value deserialized from
    /// the string representation of enums.
    pub fn value(&self) -> std::option::Option<i32> {
        match self {
            Self::Unspecified => std::option::Option::Some(0),
            Self::ExtProcGrpc => std::option::Option::Some(1),
            Self::UnknownValue(u) => u.0.value(),
        }
    }

    /// Gets the enum value as a string.
    ///
    /// Returns `None` if the enum contains an unknown value deserialized from
    /// the integer representation of enums.
    pub fn name(&self) -> std::option::Option<&str> {
        match self {
            Self::Unspecified => std::option::Option::Some("WIRE_FORMAT_UNSPECIFIED"),
            Self::ExtProcGrpc => std::option::Option::Some("EXT_PROC_GRPC"),
            Self::UnknownValue(u) => u.0.name(),
        }
    }
}

impl std::default::Default for WireFormat {
    fn default() -> Self {
        use std::convert::From;
        Self::from(0)
    }
}

impl std::fmt::Display for WireFormat {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
        wkt::internal::display_enum(f, self.name(), self.value())
    }
}

impl std::convert::From<i32> for WireFormat {
    fn from(value: i32) -> Self {
        match value {
            0 => Self::Unspecified,
            1 => Self::ExtProcGrpc,
            _ => Self::UnknownValue(wire_format::UnknownValue(
                wkt::internal::UnknownEnumValue::Integer(value),
            )),
        }
    }
}

impl std::convert::From<&str> for WireFormat {
    fn from(value: &str) -> Self {
        use std::string::ToString;
        match value {
            "WIRE_FORMAT_UNSPECIFIED" => Self::Unspecified,
            "EXT_PROC_GRPC" => Self::ExtProcGrpc,
            _ => Self::UnknownValue(wire_format::UnknownValue(
                wkt::internal::UnknownEnumValue::String(value.to_string()),
            )),
        }
    }
}

impl serde::ser::Serialize for WireFormat {
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        match self {
            Self::Unspecified => serializer.serialize_i32(0),
            Self::ExtProcGrpc => serializer.serialize_i32(1),
            Self::UnknownValue(u) => u.0.serialize(serializer),
        }
    }
}

impl<'de> serde::de::Deserialize<'de> for WireFormat {
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        deserializer.deserialize_any(wkt::internal::EnumVisitor::<WireFormat>::new(
            ".google.cloud.networkservices.v1.WireFormat",
        ))
    }
}

/// Determines the information that should be returned by the server.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum WasmPluginView {
    /// Unspecified value. Do not use.
    Unspecified,
    /// If specified in the `GET` request for a `WasmPlugin` resource, the server's
    /// response includes just the `WasmPlugin` resource.
    Basic,
    /// If specified in the `GET` request for a `WasmPlugin` resource, the server's
    /// response includes the `WasmPlugin` resource with all its versions.
    Full,
    /// If set, the enum was initialized with an unknown value.
    ///
    /// Applications can examine the value using [WasmPluginView::value] or
    /// [WasmPluginView::name].
    UnknownValue(wasm_plugin_view::UnknownValue),
}

#[doc(hidden)]
pub mod wasm_plugin_view {
    #[allow(unused_imports)]
    use super::*;
    #[derive(Clone, Debug, PartialEq)]
    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}

impl WasmPluginView {
    /// Gets the enum value.
    ///
    /// Returns `None` if the enum contains an unknown value deserialized from
    /// the string representation of enums.
    pub fn value(&self) -> std::option::Option<i32> {
        match self {
            Self::Unspecified => std::option::Option::Some(0),
            Self::Basic => std::option::Option::Some(1),
            Self::Full => std::option::Option::Some(2),
            Self::UnknownValue(u) => u.0.value(),
        }
    }

    /// Gets the enum value as a string.
    ///
    /// Returns `None` if the enum contains an unknown value deserialized from
    /// the integer representation of enums.
    pub fn name(&self) -> std::option::Option<&str> {
        match self {
            Self::Unspecified => std::option::Option::Some("WASM_PLUGIN_VIEW_UNSPECIFIED"),
            Self::Basic => std::option::Option::Some("WASM_PLUGIN_VIEW_BASIC"),
            Self::Full => std::option::Option::Some("WASM_PLUGIN_VIEW_FULL"),
            Self::UnknownValue(u) => u.0.name(),
        }
    }
}

impl std::default::Default for WasmPluginView {
    fn default() -> Self {
        use std::convert::From;
        Self::from(0)
    }
}

impl std::fmt::Display for WasmPluginView {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
        wkt::internal::display_enum(f, self.name(), self.value())
    }
}

impl std::convert::From<i32> for WasmPluginView {
    fn from(value: i32) -> Self {
        match value {
            0 => Self::Unspecified,
            1 => Self::Basic,
            2 => Self::Full,
            _ => Self::UnknownValue(wasm_plugin_view::UnknownValue(
                wkt::internal::UnknownEnumValue::Integer(value),
            )),
        }
    }
}

impl std::convert::From<&str> for WasmPluginView {
    fn from(value: &str) -> Self {
        use std::string::ToString;
        match value {
            "WASM_PLUGIN_VIEW_UNSPECIFIED" => Self::Unspecified,
            "WASM_PLUGIN_VIEW_BASIC" => Self::Basic,
            "WASM_PLUGIN_VIEW_FULL" => Self::Full,
            _ => Self::UnknownValue(wasm_plugin_view::UnknownValue(
                wkt::internal::UnknownEnumValue::String(value.to_string()),
            )),
        }
    }
}

impl serde::ser::Serialize for WasmPluginView {
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        match self {
            Self::Unspecified => serializer.serialize_i32(0),
            Self::Basic => serializer.serialize_i32(1),
            Self::Full => serializer.serialize_i32(2),
            Self::UnknownValue(u) => u.0.serialize(serializer),
        }
    }
}

impl<'de> serde::de::Deserialize<'de> for WasmPluginView {
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        deserializer.deserialize_any(wkt::internal::EnumVisitor::<WasmPluginView>::new(
            ".google.cloud.networkservices.v1.WasmPluginView",
        ))
    }
}
